• Yegor's avatar
    [framework,web] add FlutterTimeline and semantics benchmarks that use it (#128366) · 07772a3d
    Yegor authored
    ## FlutterTimeline
    
    Add a new class `FlutterTimeline` that's a drop-in replacement for `Timeline` from `dart:developer`. In addition to forwarding invocations of `startSync`, `finishSync`, `timeSync`, and `instantSync` to `dart:developer`, provides the following extra methods that make is easy to collect timings for code blocks on a frame-by-frame basis:
    
    * `debugCollect()` - aggregates timings since the last reset, or since the app launched.
    * `debugReset()` - forgets all data collected since the previous reset, or since the app launched. This allows clearing data from previous frames so timings can be attributed to the current frame.
    * `now` - this was enhanced so that it works on the web by calling `window.performance.now` (in `Timeline` this is a noop in Dart web compilers).
    * `collectionEnabled` - a field that controls whether `FlutterTimeline` stores timings in memory. By default this is disabled to avoid unexpected overhead (although the class is designed for minimal and predictable overhead). Specific benchmarks can enable collection to report to Skia Perf.
    
    ## Semantics benchmarks
    
    Add `BenchMaterial3Semantics` that benchmarks the cost of semantics when constructing a screen full of Material 3 widgets from nothing. It is expected that semantics will have non-trivial cost in this case, but we should strive to keep it much lower than the rendering cost. This is the case already. This benchmark shows that the cost of semantics is <10%.
    
    Add `BenchMaterial3ScrollSemantics` that benchmarks the cost of scrolling a previously constructed screen full of Material 3 widgets. The expectation should be that semantics will have trivial cost, since we're just shifting some widgets around. As of today, the numbers are not great, with semantics taking >50% of frame time, which is what prompted this PR in the first place. As we optimize this, we want to see this number improve.
    07772a3d
Name
Last commit
Last update
..
_compute_caller.dart Loading commit data...
_compute_caller_error.dart Loading commit data...
_compute_caller_invalid_error.dart Loading commit data...
_compute_caller_invalid_message.dart Loading commit data...
assertions_test.dart Loading commit data...
basic_types_test.dart Loading commit data...
binding_2_test.dart Loading commit data...
binding_test.dart Loading commit data...
bit_field_test.dart Loading commit data...
caching_iterable_test.dart Loading commit data...
capture_output.dart Loading commit data...
change_notifier_test.dart Loading commit data...
collections_test.dart Loading commit data...
consolidate_response_test.dart Loading commit data...
constants_test.dart Loading commit data...
covariant_templates_test.dart Loading commit data...
debug_test.dart Loading commit data...
diagnostics_json_test.dart Loading commit data...
diagnostics_test.dart Loading commit data...
double_precision_test.dart Loading commit data...
error_reporting_test.dart Loading commit data...
isolates_test.dart Loading commit data...
leak_tracking.dart Loading commit data...
leak_tracking_test.dart Loading commit data...
licenses_test.dart Loading commit data...
math_test.dart Loading commit data...
memory_allocations_test.dart Loading commit data...
observer_list_test.dart Loading commit data...
persistent_hash_map_test.dart Loading commit data...
print_test.dart Loading commit data...
reassemble_test.dart Loading commit data...
serialization_test.dart Loading commit data...
service_extensions_test.dart Loading commit data...
stack_frame_test.dart Loading commit data...
stack_trace_test.dart Loading commit data...
synchronous_future_test.dart Loading commit data...
timeline_test.dart Loading commit data...