dart-lang / dart_style

An opinionated formatter/linter for Dart code
https://pub.dev/packages/dart_style
BSD 3-Clause "New" or "Revised" License
645 stars 117 forks source link

Support running benchmarks in AOT mode. #1486

Closed munificent closed 3 months ago

munificent commented 3 months ago

Many of the optimizations I'm trying have a relatively small improvement. That can make it hard to tell if they are actually an improvement if there is enough variance in the runs that they are lost in the noise.

AOT builds don't need warm-up time and seem to have generally lower variance than JIT runs. Also, they are how the shipped formatter is run in dart format. So this adds support to the two benchmark scripts for running themselves in AOT snapshot mode.

I added support for this directly to the scripts instead of just manually compiling and running them on the command line (which works fine) because this way it's less error-prone. I don't have to remember to re-compile the AOT snapshot and risk using an old build which is an easy mistake to make when the only behavioral difference is (possibly) performance.

Also, tweaked the profiler output a little.