Unverified Commit 56298610 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Revert "Reland: Increase threshold for usage of compute for utf8 decoding on...

Revert "Reland: Increase threshold for usage of compute for utf8 decoding on large strings to 50 KB (#64498)" (#64652)

This reverts commit 54e2a0e6.
parent dd9015c2
...@@ -71,13 +71,11 @@ abstract class AssetBundle { ...@@ -71,13 +71,11 @@ abstract class AssetBundle {
// that the null-handling logic is dead code). // that the null-handling logic is dead code).
if (data == null) if (data == null)
throw FlutterError('Unable to load asset: $key'); // ignore: dead_code throw FlutterError('Unable to load asset: $key'); // ignore: dead_code
// 50 KB of data should take 2-3 ms to parse on a Moto G4, and about 400 μs if (data.lengthInBytes < 10 * 1024) {
// on a Pixel 4. // 10KB takes about 3ms to parse on a Pixel 2 XL.
if (data.lengthInBytes < 50 * 1024) { // See: https://github.com/dart-lang/sdk/issues/31954
return utf8.decode(data.buffer.asUint8List()); return utf8.decode(data.buffer.asUint8List());
} }
// For strings larger than 50 KB, run the computation in an isolate to
// avoid causing main thread jank.
return compute(_utf8decode, data, debugLabel: 'UTF8 decode for "$key"'); return compute(_utf8decode, data, debugLabel: 'UTF8 decode for "$key"');
} }
......
...@@ -562,11 +562,9 @@ class HotRunner extends ResidentRunner { ...@@ -562,11 +562,9 @@ class HotRunner extends ResidentRunner {
} on vm_service.RPCError { } on vm_service.RPCError {
// Do nothing, we're already subcribed. // Do nothing, we're already subcribed.
} }
// Ideally this would wait for kIsolateRunnable, but either this subscription occurs too
// late to receive the event, or it is not forwarded for hot restarted isolates.
isolateNotifications.add( isolateNotifications.add(
device.vmService.onIsolateEvent.firstWhere((vm_service.Event event) { device.vmService.onIsolateEvent.firstWhere((vm_service.Event event) {
return event.kind == vm_service.EventKind.kServiceExtensionAdded; return event.kind == vm_service.EventKind.kIsolateRunnable;
}), }),
); );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment