From 78763d0f7b8dabe3c208ac1dee10fd11e9e6bf6d Mon Sep 17 00:00:00 2001 From: Kenzie Davisson <43759233+kenzieschmoll@users.noreply.github.com> Date: Mon, 11 Dec 2023 17:10:22 -0800 Subject: [PATCH] Add a flag to run benchmark tests with skwasm (#6950) --- packages/devtools_app/benchmark/README.md | 1 + .../benchmark/scripts/run_benchmarks.dart | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/devtools_app/benchmark/README.md b/packages/devtools_app/benchmark/README.md index a43ff0dd9ed..fbc94ef3bb6 100644 --- a/packages/devtools_app/benchmark/README.md +++ b/packages/devtools_app/benchmark/README.md @@ -29,6 +29,7 @@ Provide arguments to the `run_benchmarks.dart` script in order to: * save the benchmark results to a file * run the benchmarks in the browser * run the benchmarks with the `dart2wasm` compiler +* run the benchmarks with the `skwasm` web renderer Run `dart run benchmark/scripts/run_benchmarks.dart -h` to see details. diff --git a/packages/devtools_app/benchmark/scripts/run_benchmarks.dart b/packages/devtools_app/benchmark/scripts/run_benchmarks.dart index 7799ce16c1a..7c029fd9d99 100644 --- a/packages/devtools_app/benchmark/scripts/run_benchmarks.dart +++ b/packages/devtools_app/benchmark/scripts/run_benchmarks.dart @@ -30,7 +30,12 @@ Future main(List args) async { await serveWebBenchmark( benchmarkAppDirectory: projectRootDirectory(), entryPoint: 'benchmark/test_infra/client.dart', - compilationOptions: CompilationOptions(useWasm: benchmarkArgs.useWasm), + compilationOptions: CompilationOptions( + useWasm: benchmarkArgs.useWasm, + renderer: benchmarkArgs.useSkwasm + ? WebRenderer.skwasm + : WebRenderer.canvaskit, + ), treeShakeIcons: false, initialPage: benchmarkInitialPage, headless: !benchmarkArgs.useBrowser, @@ -99,6 +104,8 @@ class BenchmarkArgs { bool get useWasm => argResults[_wasmFlag]; + bool get useSkwasm => argResults[_skwasmFlag]; + int get averageOf => int.parse(argResults[_averageOfOption]); String? get saveToFileLocation => argResults[_saveToFileOption]; @@ -109,6 +116,8 @@ class BenchmarkArgs { static const _wasmFlag = 'wasm'; + static const _skwasmFlag = 'skwasm'; + static const _saveToFileOption = 'save-to-file'; static const _baselineOption = 'baseline'; @@ -128,6 +137,12 @@ class BenchmarkArgs { negatable: false, help: 'Runs the benchmark tests with dart2wasm', ) + ..addFlag( + _skwasmFlag, + negatable: false, + help: + 'Runs the benchmark tests with the skwasm renderer instead of canvaskit.', + ) ..addOption( _saveToFileOption, help: 'Saves the benchmark results to a JSON file at the given path.',