There are two types of benchmarks that we currently support: size and performance.
devtools_benchmarks_test.dart
- measures DevTools frame times.web_bundle_size_test.dart
- measures DevTools release build size.The benchmark tests are run automatically on the CI. See the “benchmark-performance” and “benchmark-size” jobs.
[!NOTE] The performance and size benchmarks cannot be run concurrently (e.g. by running
flutter test benchmark/
). See the #caveats section below.
All of the commands below should be run from the packages/devtools_app
directory.
To run the performance benchmark tests locally, run:
dart run benchmark/scripts/run_benchmarks.dart
Provide arguments to the run_benchmarks.dart
script in order to:
dart2wasm
compilerskwasm
web rendererRun dart run benchmark/scripts/run_benchmarks.dart -h
to see details.
To run the test that verifies we can run benchmark tests, run:
flutter test benchmark/devtools_benchmarks_test.dart
To run the size benchmark test locally, run:
flutter test benchmark/web_bundle_size_test.dart
The size benchmark must be ran by itself because it actually modifies the devtools_app/build
folder to create and measure the release build web bundle size. If this test is ran while other tests are running, it can affect the measurements that the size benchmark test takes, and it can affect the DevTools build that the other running tests are using.
The tests are defined by “automators”, which live in the benchmark/test_infra/automators
directory. To add a new test or test case, either modify an existing automator or add a new one for a new screen. Follow existing examples in that directory for guidance.
There are two ways to calculate the delta between two benchmark test runs:
Compare two benchmarks from file:
dart run benchmark/scripts/run_benchmarks.dart --save-to-file=/Users/me/baseline.json dart run benchmark/scripts/run_benchmarks.dart --save-to-file=/Users/me/test.json
dart run benchmark/scripts/compare_benchmarks.dart /Users/me/baseline_file.json /Users/me/test_file.json
Compare a new benchmark run with a benchmark from file:
--baseline
flag when running the run_benchmarks.dart
script:dart run benchmark/scripts/run_benchmarks.dart --baseline=/Users/me/baseline_file.json``