Repository navigation
Web Benchmarks Part 2: Benchmark Targeting & Fail-Fast Filtering - #194400
auto-submit[bot] merged 16 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces command-line argument parsing and filtering capabilities to the web benchmarks task in the Flutter devicelab, allowing benchmarks to be filtered by target names or regex patterns. Feedback on the changes suggests moving JSON decoding inside a try-catch block to prevent server crashes, using safe type checks instead of direct casts for profile names and score keys to avoid runtime type errors, and refactoring a test that incorrectly uses duplicate keys in a map literal.
Specifying explicit target benchmarks (--benchmark / BENCHMARK_TARGETS) together with a filter pattern (--filter / BENCHMARK_FILTER) is now an error instead of intersecting the two. This applies whether the values come from arguments, environment variables, or one of each, and fails before anything is built.
| ..addMultiOption( | ||
| 'benchmark', | ||
| help: | ||
| 'Target benchmark names to run (comma-separated or multiple flags). ' |
There was a problem hiding this comment.
How do you expect this to be invoked? Going through test_runner.dart test --task-args benchmark=draw_rect,bench_card, the runner splits --task-args on commas, so this task receives --benchmark=draw_rect --bench_card and fails on the unknown --bench_card option.
There was a problem hiding this comment.
In a forthcoming PR I am adding a CLI entrypoint which let's you directly pass in --benchmark. So you could do dart dev/devicelab/bin/run_local_web_benchmark.dart --benchmark=draw_rect,bench_card.
But if running through task_runner.dart, you could still do --task-args benchmark=draw_rect,benchmark=bench_card.
If we think the "(comma-separated or multiple flags)" wording is misleading to users of task_runner.dart I can tweak the help text or we can make it so that we don't support comma-separated in this entrypoint and only allow it in my forthcoming local benchmark runner entrypoint
|
Thanks, @mdebbar ! PTAL |
…tter#194400) Adds benchmark targeting, fail-fast filtering, and incremental build support (`--no-clean`) to `runWebBenchmark` in `dev/devicelab/lib/tasks/web_benchmarks.dart`: - Retains the `WebBenchmarkOptions` record typedef and adds optional `targetBenchmarks`, `filterPattern`, and `clean` named parameters to `runWebBenchmark` with `BENCHMARK_TARGETS`, `BENCHMARK_FILTER`, and `BENCHMARK_CLEAN` environment variable fallbacks. - Adds `runWebBenchmarkFromArgs` so the `dev/devicelab/bin/tasks/web_benchmarks_*.dart` task entrypoints accept `--benchmark` (`-b`), `--filter` (`-f`), and `--[no-]clean` CLI flags. - Extracts `BenchmarkFilter` and `processBenchmarkProfiles` so unrecognized benchmark names (typos), zero-match regexes, or empty profile collections fail fast instead of returning a false-positive `TaskResult.success({})`. - Adds hermetic unit tests in `dev/devicelab/test/tasks/web_benchmarks_test.dart`. Part of flutter#191316 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant in-code documentation (doc comments with `///`). - [x] If this PR introduces a new feature or capability, I created and linked a website documentation issue or PR in [flutter/website] (or verified none is needed). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/CONTRIBUTING.ai.md [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [flutter/website]: https://github.com/flutter/website [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Adds benchmark targeting, fail-fast filtering, and incremental build support (
--no-clean) torunWebBenchmarkindev/devicelab/lib/tasks/web_benchmarks.dart:WebBenchmarkOptionsrecord typedef and adds optionaltargetBenchmarks,filterPattern, andcleannamed parameters torunWebBenchmarkwithBENCHMARK_TARGETS,BENCHMARK_FILTER, andBENCHMARK_CLEANenvironment variable fallbacks.runWebBenchmarkFromArgsso thedev/devicelab/bin/tasks/web_benchmarks_*.darttask entrypoints accept--benchmark(-b),--filter(-f), and--[no-]cleanCLI flags.BenchmarkFilterandprocessBenchmarkProfilesso unrecognized benchmark names (typos), zero-match regexes, or empty profile collections fail fast instead of returning a false-positiveTaskResult.success({}).dev/devicelab/test/tasks/web_benchmarks_test.dart.Part of #191316
Pre-launch Checklist
///).