Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion workloads/Dart/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/wasm_gc_benchmarks/
/flute/
/dart-sdk/
/dartsdk.zip
5 changes: 2 additions & 3 deletions workloads/Dart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ This is a WasmGC build of the `flute` benchmark, a Dart application using the
It performs the Wasm/compute-only part of rendering a certain number of frames.
Since JetStream runs in JS engine shells, the actual rendering to a Canvas is
stubbed out.
The upstream repository containing pre-built WebAssembly binaries (which we
use here) is at https://github.com/mkustermann/wasm_gc_benchmarks.
The Dart source code of the flute application is at https://github.com/dart-lang/flute.
The benchmark harness (`addTaskQueue`) in `benchmark.js` comes from https://github.com/mkustermann/wasm_gc_benchmarks,
and `build.sh` compiles the WasmGC binaries directly from https://github.com/dart-lang/flute.

## Build Instructions

Expand Down
21 changes: 16 additions & 5 deletions workloads/Dart/build.log
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
Built on Thu Aug 14 04:47:37 PM CEST 2025
Cloning into 'wasm_gc_benchmarks'...
13951e1 Roll new version of flute and regenerate flute-based benchmarks
Copying files from wasm_gc_benchmarks/ into build/
Build success
Built on 2026-11-03T17:54:12Z
Downloading Dart SDK 3.14.0-315.3.beta (linux-x64)...
Toolchain versions
Dart SDK version: 3.14.0-315.3.beta (beta) (Thu Oct 22 14:42:43 2026 -0700) on "linux_x64"
Getting sources...
flute commit:
712764b Bump the github-actions group with 2 updates
Getting Dart dependencies...
Resolving dependencies...
Downloading packages...
Got dependencies!
Compiling flute.complex to wasm...
Generated wasm module '../../build/flute.complex.dart2wasm.wasm', and JS init file '../../build/flute.complex.dart2wasm.mjs'.
Compiling flute.todomvc to wasm...
Generated wasm module '../../build/flute.todomvc.dart2wasm.wasm', and JS init file '../../build/flute.todomvc.dart2wasm.mjs'.
Build success
62 changes: 50 additions & 12 deletions workloads/Dart/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,63 @@

set -eo pipefail

# Dart 3.14 emits standard Wasm exception handling (`try_table`) by default
# (https://github.com/dart-lang/sdk/issues/54394).
# TODO: Switch DART_CHANNEL="stable" and DART_SDK_VERSION="3.14.0" once Dart
# 3.14 stable ships.
DART_CHANNEL="beta"
DART_SDK_VERSION="3.14.0-315.3.beta"
FLUTE_COMMIT="712764b186549d919a31d2fc8cc9da4e9a633eb3"

# Cleanup old files.
rm -rf wasm_gc_benchmarks/
rm -rf flute/ dart-sdk/ dartsdk.zip
rm -rf build/

BUILD_LOG="$(realpath build.log)"
echo -e "Built on $(date)" | tee "$BUILD_LOG"
echo -e "Built on $(date -u '+%Y-%m-%dT%H:%M:%SZ')" | tee "$BUILD_LOG"

case "$(uname -s)-$(uname -m)" in
Linux-x86_64) DART_PLATFORM="linux-x64" ;;
Linux-aarch64) DART_PLATFORM="linux-arm64" ;;
Darwin-x86_64) DART_PLATFORM="macos-x64" ;;
Darwin-arm64) DART_PLATFORM="macos-arm64" ;;
*) echo "Unsupported platform: $(uname -s)-$(uname -m)" >&2; exit 1 ;;
esac

echo "Downloading Dart SDK $DART_SDK_VERSION ($DART_PLATFORM)..." | tee -a "$BUILD_LOG"
curl -sSf -o dartsdk.zip "https://storage.googleapis.com/dart-archive/channels/$DART_CHANNEL/release/$DART_SDK_VERSION/sdk/dartsdk-$DART_PLATFORM-release.zip"
unzip -q dartsdk.zip
rm dartsdk.zip
DART_BIN="$(realpath dart-sdk/bin/dart)"
"$DART_BIN" --disable-analytics >/dev/null 2>&1 || true

git clone https://github.com/mkustermann/wasm_gc_benchmarks 2>&1 | tee -a "$BUILD_LOG"
pushd wasm_gc_benchmarks/
echo "Toolchain versions" | tee -a "$BUILD_LOG"
"$DART_BIN" --version 2>&1 | tee -a "$BUILD_LOG"

echo "Getting sources..." | tee -a "$BUILD_LOG"
git clone -q https://github.com/dart-lang/flute.git flute 2>&1 | tee -a "$BUILD_LOG"
pushd flute/
git checkout -q "$FLUTE_COMMIT"
echo "flute commit:" | tee -a "$BUILD_LOG"
git log -1 --oneline | tee -a "$BUILD_LOG"

pushd benchmarks/
echo "Getting Dart dependencies..." | tee -a "$BUILD_LOG"
"$DART_BIN" pub get 2>&1 | tee -a "$BUILD_LOG"

# Same flags as `wasm_gc_benchmarks/compile.sh`, which built the JetStream 3.0
# binaries. -O2 is also what `flutter build web --wasm` uses for release builds,
# and --no-strip-wasm keeps the name section for profiling.
mkdir -p ../../build/
echo "Compiling flute.complex to wasm..." | tee -a "$BUILD_LOG"
"$DART_BIN" compile wasm -Ddart.vm.product=true -O2 --no-strip-wasm -o ../../build/flute.complex.dart2wasm.wasm lib/complex.dart 2>&1 | tee -a "$BUILD_LOG"

echo "Compiling flute.todomvc to wasm..." | tee -a "$BUILD_LOG"
"$DART_BIN" compile wasm -Ddart.vm.product=true -O2 --no-strip-wasm -o ../../build/flute.todomvc.dart2wasm.wasm lib/todomvc.dart 2>&1 | tee -a "$BUILD_LOG"
popd
popd

echo "Copying files from wasm_gc_benchmarks/ into build/" | tee -a "$BUILD_LOG"
mkdir -p build/ | tee -a "$BUILD_LOG"
# Two Flute benchmark applications: complex and todomvc
cp wasm_gc_benchmarks/benchmarks-out/flute.complex.dart2wasm.{mjs,wasm} build/ | tee -a "$BUILD_LOG"
cp wasm_gc_benchmarks/benchmarks-out/flute.todomvc.dart2wasm.{mjs,wasm} build/ | tee -a "$BUILD_LOG"
# The benchmark only needs the .wasm and .mjs files.
rm -f build/*.support.js build/*.wasm.map

echo "Build success" | tee -a "$BUILD_LOG"

# TODO: We could actually build the application/benchmark from Dart sources with
# the dart2wasm compiler / Dart SDK. See `wasm_gc_benchmarks/compile.sh`
Loading
Loading