-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
area-dart2wasmIssues for the dart2wasm compiler.Issues for the dart2wasm compiler.
Description
Here's a list of remaining things we probably need to do before dart compile wasm can be used by flutter tools (right now it invokes the dart2wasm AOT snapshot burried in our SDK directly and wasm-opt with it's own set of binaryen flags):
- Performance 16x slower (see below)
- Support
-Ddefines - Support
--dart-sdk&--platform - Support
--import-shared-memory&--shared-memory-max-pages - Support
--depfile - Support passing through arbitrary args to dart2wasm (may also be used to do the above) - similar to (
--extra-gen-snapshot-optionsin VM)
Performance
dart compile wasm is running the dart2wasm compiler in it's implementation (it doesn't use the dart2wasm AOT snapshot). Though the DartDev AppJIT training doesn't include dart2wasm compilation. That means the code will run slow.
It takes 8.5 seconds to run dart compile wasm vs 0.5 seconds by running the AOT snapshot (what flutter does):
% echo 'main() {}' > hello.dart
% time out/ReleaseX64/dart-sdk/bin/dart compile wasm --no-optimize hello.dart
*NOTE*: Compilation to WasmGC is experimental.
The support may change, or be removed, with no advance notice.
Generated wasm module 'hello.wasm', and JS init file 'hello.mjs'.
out/ReleaseX64/dart-sdk/bin/dart compile wasm --no-optimize hello.dart 12.87s user 1.81s system 173% cpu 8.471 total
% time out/ReleaseX64/dart-sdk/bin/dartaotruntime out/ReleaseX64/dart-sdk/bin/snapshots/dart2wasm_product.snapshot --platform=$PWD/out/ReleaseX64/dart-sdk/lib/_internal/dart2wasm_platform.dill --dart-sdk=$PWD/out/ReleaseX64/dart-sdk hello.dart hello.wasm
out/ReleaseX64/dart-sdk/bin/dartaotruntime hello.dart hello.wasm 0.48s user 0.15s system 111% cpu 0.564 total
It's a little unclear to my why we wouldn't just run the dart2wasm AOT snapshot that we already bundle in the SDK for doing the compilation.
/cc @mit-mit
mnordine
Metadata
Metadata
Assignees
Labels
area-dart2wasmIssues for the dart2wasm compiler.Issues for the dart2wasm compiler.