const vs. non-const widget build benchmark (#148261)

This benchmark illustrates the impact that const'ness has on widget build times by building a widget tree with all const-widgets and then building the same widget tree without any const'ness. Local testing with this benchmark running on a Moto G4 shows that const'ness is 13-16% faster.

I'd like to check this benchmark in because the question of how important widget const'ness is comes up every so often. With this benchmark we have up-to-date data to point people to.
This commit is contained in:
Michael Goderbauer
2024-05-16 16:23:14 -07:00
committed by GitHub
parent 54830cf143
commit c4ad1dc1e9
2 changed files with 230 additions and 0 deletions

View File

@@ -75,6 +75,7 @@ TaskFunction createMicrobenchmarkTask({
...await runMicrobench('lib/stocks/layout_bench.dart'),
...await runMicrobench('lib/ui/image_bench.dart'),
...await runMicrobench('lib/layout/text_intrinsic_bench.dart'),
...await runMicrobench('lib/building/const_vs_non_const_bench.dart'),
};
return TaskResult.success(allResults,