mirror of
https://github.com/flutter/packages.git
synced 2025-07-01 07:08:10 +08:00
Update web_benchmarks
package to properly support wasm. (#6970)
This fixes the web_benchmarks package so it can compile and run apps with wasm. It also updates our CI steps to use a newer version of Chrome so that WasmGC works properly.
This commit is contained in:
10
.ci.yaml
10
.ci.yaml
@ -65,7 +65,7 @@ platform_properties:
|
||||
device_type: none
|
||||
dependencies: >-
|
||||
[
|
||||
{"dependency": "chrome_and_driver", "version": "version:114.0"}
|
||||
{"dependency": "chrome_and_driver", "version": "version:125.0.6422.141"}
|
||||
]
|
||||
windows_arm64:
|
||||
properties:
|
||||
@ -327,7 +327,7 @@ targets:
|
||||
{"dependency": "clang", "version": "git_revision:5d5aba78dbbee75508f01bcaa69aedb2ab79065a"},
|
||||
{"dependency": "cmake", "version": "build_id:8787856497187628321"},
|
||||
{"dependency": "ninja", "version": "version:1.9.0"},
|
||||
{"dependency": "chrome_and_driver", "version": "version:114.0"}
|
||||
{"dependency": "chrome_and_driver", "version": "version:125.0.6422.141"}
|
||||
]
|
||||
channel: master
|
||||
env_variables: >-
|
||||
@ -350,7 +350,7 @@ targets:
|
||||
{"dependency": "clang", "version": "git_revision:5d5aba78dbbee75508f01bcaa69aedb2ab79065a"},
|
||||
{"dependency": "cmake", "version": "build_id:8787856497187628321"},
|
||||
{"dependency": "ninja", "version": "version:1.9.0"},
|
||||
{"dependency": "chrome_and_driver", "version": "version:114.0"}
|
||||
{"dependency": "chrome_and_driver", "version": "version:125.0.6422.141"}
|
||||
]
|
||||
channel: stable
|
||||
env_variables: >-
|
||||
@ -935,7 +935,7 @@ targets:
|
||||
# Install Chrome as a default handler for schemes for url_launcher.
|
||||
dependencies: >-
|
||||
[
|
||||
{"dependency": "chrome_and_driver", "version": "version:114.0"}
|
||||
{"dependency": "chrome_and_driver", "version": "version:125.0.6422.141"}
|
||||
]
|
||||
env_variables: >-
|
||||
{
|
||||
@ -953,7 +953,7 @@ targets:
|
||||
# Install Chrome as a default handler for schemes for url_launcher.
|
||||
dependencies: >-
|
||||
[
|
||||
{"dependency": "chrome_and_driver", "version": "version:114.0"}
|
||||
{"dependency": "chrome_and_driver", "version": "version:125.0.6422.141"}
|
||||
]
|
||||
env_variables: >-
|
||||
{
|
||||
|
@ -1,6 +1,10 @@
|
||||
## NEXT
|
||||
## 2.0.0
|
||||
|
||||
* Updates minimum supported SDK version to Flutter 3.16/Dart 3.2.
|
||||
* Adds support for running benchmarks with the wasm compilation target.
|
||||
* **Breaking change** `CompilationOptions` unnamed constructor has been replaced with
|
||||
two named constructors, `CompilationOptions.js` and `CompilationOptions.wasm` for
|
||||
JavaScript and WebAssembly compilation respectively.
|
||||
|
||||
## 1.2.2
|
||||
|
||||
|
@ -50,7 +50,7 @@ Future<BenchmarkResults> serveWebBenchmark({
|
||||
bool headless = true,
|
||||
bool treeShakeIcons = true,
|
||||
String initialPage = defaultInitialPage,
|
||||
CompilationOptions compilationOptions = const CompilationOptions(),
|
||||
CompilationOptions compilationOptions = const CompilationOptions.js(),
|
||||
}) async {
|
||||
// Reduce logging level. Otherwise, package:webkit_inspection_protocol is way too spammy.
|
||||
Logger.root.level = Level.INFO;
|
||||
|
@ -7,11 +7,15 @@
|
||||
/// This object holds metadata that is used to determine how the benchmark app
|
||||
/// should be built.
|
||||
class CompilationOptions {
|
||||
/// Creates a [CompilationOptions] object.
|
||||
const CompilationOptions({
|
||||
/// Creates a [CompilationOptions] object that compiles to JavaScript.
|
||||
const CompilationOptions.js({
|
||||
this.renderer = WebRenderer.canvaskit,
|
||||
this.useWasm = false,
|
||||
});
|
||||
}) : useWasm = false;
|
||||
|
||||
/// Creates a [CompilationOptions] object that compiles to WebAssembly.
|
||||
const CompilationOptions.wasm()
|
||||
: useWasm = true,
|
||||
renderer = WebRenderer.skwasm;
|
||||
|
||||
/// The renderer to use for the build.
|
||||
final WebRenderer renderer;
|
||||
|
@ -55,7 +55,7 @@ class BenchmarkServer {
|
||||
required this.chromeDebugPort,
|
||||
required this.headless,
|
||||
required this.treeShakeIcons,
|
||||
this.compilationOptions = const CompilationOptions(),
|
||||
this.compilationOptions = const CompilationOptions.js(),
|
||||
this.initialPage = defaultInitialPage,
|
||||
});
|
||||
|
||||
@ -119,10 +119,9 @@ class BenchmarkServer {
|
||||
'web',
|
||||
if (compilationOptions.useWasm) ...<String>[
|
||||
'--wasm',
|
||||
'--wasm-opt=debug',
|
||||
'--omit-type-checks',
|
||||
],
|
||||
'--web-renderer=${compilationOptions.renderer.name}',
|
||||
'--no-strip-wasm',
|
||||
] else
|
||||
'--web-renderer=${compilationOptions.renderer.name}',
|
||||
'--dart-define=FLUTTER_WEB_ENABLE_PROFILING=true',
|
||||
if (!treeShakeIcons) '--no-tree-shake-icons',
|
||||
'--profile',
|
||||
|
@ -2,7 +2,7 @@ name: web_benchmarks
|
||||
description: A benchmark harness for performance-testing Flutter apps in Chrome.
|
||||
repository: https://github.com/flutter/packages/tree/main/packages/web_benchmarks
|
||||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+web_benchmarks%22
|
||||
version: 1.2.2
|
||||
version: 2.0.0
|
||||
|
||||
environment:
|
||||
sdk: ^3.3.0
|
||||
|
@ -21,16 +21,6 @@ found in the LICENSE file. -->
|
||||
<link rel="manifest" href="manifest.json">
|
||||
</head>
|
||||
<body>
|
||||
<!-- This script installs service_worker.js to provide PWA functionality to
|
||||
application. For more information, see:
|
||||
https://developers.google.com/web/fundamentals/primers/service-workers -->
|
||||
<script>
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', function () {
|
||||
navigator.serviceWorker.register('flutter_service_worker.js');
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script src="main.dart.js" type="application/javascript"></script>
|
||||
<script src="flutter_bootstrap.js" type="application/javascript" async></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -32,10 +32,9 @@ Future<void> main() async {
|
||||
await _runBenchmarks(
|
||||
benchmarkNames: <String>['simple'],
|
||||
entryPoint: 'lib/benchmarks/runner_simple.dart',
|
||||
compilationOptions: const CompilationOptions(useWasm: true),
|
||||
compilationOptions: const CompilationOptions.wasm(),
|
||||
);
|
||||
},
|
||||
skip: true, // https://github.com/flutter/flutter/issues/142809
|
||||
timeout: Timeout.none,
|
||||
);
|
||||
}
|
||||
@ -44,7 +43,7 @@ Future<void> _runBenchmarks({
|
||||
required List<String> benchmarkNames,
|
||||
required String entryPoint,
|
||||
String initialPage = defaultInitialPage,
|
||||
CompilationOptions compilationOptions = const CompilationOptions(),
|
||||
CompilationOptions compilationOptions = const CompilationOptions.js(),
|
||||
}) async {
|
||||
final BenchmarkResults taskResult = await serveWebBenchmark(
|
||||
benchmarkAppDirectory: Directory('testing/test_app'),
|
||||
|
Reference in New Issue
Block a user