f1ac647125
FadeThroughStack(lazy: true) builds only the shown page first and the rest one per frame once no animation runs. Opening a run detail no longer lays out Timeline, Artifacts and Changes offstage during the route transition (transition build 62-103 ms -> 38-59 ms); first tab switches are unchanged. Adds tool/perf/interaction_bench.mjs (FrameTiming per interaction over the full-app fixture, CPU profiles mapped to Dart files), fixture options for hits/chats/graph, and notes/perf-round3.md with the survey.
36 lines
1.3 KiB
Dart
36 lines
1.3 KiB
Dart
// Frame report for the interaction bench (tool/perf/interaction_bench.mjs).
|
|
//
|
|
// With `?perf=1` the full-app fixture prints every frame's Flutter timings to
|
|
// the console as `PERF_FRAME <build us> <raster us> <total us>`, and the first
|
|
// rasterised frame as `PERF_FIRST_FRAME <ms since navigation>`.
|
|
// `window.__perfKick()` schedules a frame, so the engine hands over timings it
|
|
// is still holding back (the web engine reports them in batches). Without the
|
|
// flag nothing is installed.
|
|
import 'dart:js_interop';
|
|
|
|
import 'package:flutter/widgets.dart';
|
|
import 'package:web/web.dart' as web;
|
|
|
|
@JS('__perfKick')
|
|
external set _perfKick(JSFunction kick);
|
|
|
|
void installFrameLog(Map<String, String> params) {
|
|
if (params['perf'] != '1') return;
|
|
final binding = WidgetsFlutterBinding.ensureInitialized();
|
|
binding.addTimingsCallback((timings) {
|
|
for (final timing in timings) {
|
|
// ignore: avoid_print
|
|
print(
|
|
'PERF_FRAME ${timing.buildDuration.inMicroseconds} '
|
|
'${timing.rasterDuration.inMicroseconds} '
|
|
'${timing.totalSpan.inMicroseconds}',
|
|
);
|
|
}
|
|
});
|
|
binding.waitUntilFirstFrameRasterized.then((_) {
|
|
// ignore: avoid_print
|
|
print('PERF_FIRST_FRAME ${web.window.performance.now().round()}');
|
|
});
|
|
_perfKick = (() => binding.scheduleFrame()).toJS;
|
|
}
|