File tree Expand file tree Collapse file tree 7 files changed +27
-9
lines changed
Expand file tree Collapse file tree 7 files changed +27
-9
lines changed Original file line number Diff line number Diff line change @@ -55,3 +55,11 @@ Use following `.csproj` as a reference for enabling NativeAOT-LLVM with Bootshar
5555
5656</Project >
5757```
58+
59+ ## Binaryen
60+
61+ Optionally, after publishing with NativeAOT-LLVM, you can further optimize the produced WASM using Binaryen:
62+
63+ 1 . Install the tool https://github.com/WebAssembly/binaryen
64+ 2 . Run ` wasm-opt bin/bootsharp/bin/dotnet.native.wasm -O3 -o bin/bootsharp/bin/dotnet.native.wasm --all-features --strip-dwarf --strip-debug --vacuum `
65+ 3 . To optimize for size instead of speed, replace ` -O3 ` with ` -Oz `
Original file line number Diff line number Diff line change 111 . Install .NET https://dotnet.microsoft.com/en-us/download
2- 2 . Run ` dotnet publish `
2+ 2 . Install Binaryen https://github.com/WebAssembly/binaryen
3+ 3 . Run ` dotnet publish `
4+ 4 . Run ` wasm-opt bin/bootsharp/bin/dotnet.native.wasm -O3 -o bin/bootsharp/bin/dotnet.native.wasm --all-features --strip-dwarf --strip-debug --vacuum `
Original file line number Diff line number Diff line change 111 . Install .NET https://dotnet.microsoft.com/en-us/download
2- 2 . Run ` dotnet publish `
2+ 2 . Install Binaryen https://github.com/WebAssembly/binaryen
3+ 3 . Run ` dotnet publish `
4+ 4 . Run ` wasm-opt bin/Release/net9.0-browser/browser-wasm/publish/dotnet.native.wasm -O3 -o bin/Release/net9.0-browser/browser-wasm/publish/dotnet.native.wasm --all-features --strip-dwarf --strip-debug --vacuum `
35
46https://github.com/dotnet/runtime/issues/113979#issuecomment-2759220563
Original file line number Diff line number Diff line change 111 . Install .NET https://dotnet.microsoft.com/en-us/download
2- 2 . Run ` dotnet publish `
2+ 2 . Install Binaryen https://github.com/WebAssembly/binaryen
3+ 3 . Run ` dotnet publish `
4+ 4 . Run ` wasm-opt bin/Release/net9.0/browser-wasm/publish/dotnet.native.wasm -O3 -o bin/Release/net9.0/browser-wasm/publish/dotnet.native.wasm --all-features --strip-dwarf --strip-debug --vacuum `
Original file line number Diff line number Diff line change 111 . Install Go https://go.dev/dl
2- 2 . Copy ` {GO_INSTALL_DIR}/lib/wasm/wasm_exec.js ` to this folder
3- 3 . Run ` & { $env:GOOS="js"; $env:GOARCH="wasm"; go build -o main.wasm main.go } `
2+ 2 . Install Binaryen https://github.com/WebAssembly/binaryen
3+ 3 . Copy ` {GO_INSTALL_DIR}/lib/wasm/wasm_exec.js ` to this folder
4+ 4 . Run ` & { $env:GOOS="js"; $env:GOARCH="wasm"; go build -o main.wasm main.go } `
5+ 5 . Run ` wasm-opt main.wasm -O3 -o main.wasm --all-features --strip-dwarf --strip-debug --vacuum `
Original file line number Diff line number Diff line change @@ -16,6 +16,6 @@ All results are relative to the Rust baseline (lower is better).
1616
1717| | Rust | Zig | .NET LLVM | Bootsharp | .NET AOT | Go |
1818| -------------| -------| -------| -----------| -----------| ----------| ---------|
19- | Fibonacci | ` 1.0 ` | ` 1.0 ` | ` 1.0 ` | ` 1.0 ` | ` 1.7 ` | ` 3.8 ` |
20- | Echo Number | ` 1.0 ` | ` 0.9 ` | ` 1.6 ` | ` 14.0 ` | ` 23.5 ` | ` 718.7 ` |
21- | Echo Struct | ` 1.0 ` | ` 1.1 ` | ` 2.0 ` | ` 2.5 ` | ` 5.9 ` | ` 15.2 ` |
19+ | Fibonacci | ` 1.0 ` | ` 0.9 ` | ` 1.0 ` | ` 1.0 ` | ` 1.6 ` | ` 3.7 ` |
20+ | Echo Number | ` 1.0 ` | ` 0.8 ` | ` 1.6 ` | ` 14.0 ` | ` 23.5 ` | ` 718.7 ` |
21+ | Echo Struct | ` 1.0 ` | ` 1.0 ` | ` 2.0 ` | ` 2.5 ` | ` 5.9 ` | ` 15.2 ` |
Original file line number Diff line number Diff line change 111 . Install Zig https://ziglang.org/download/
2- 2 . Run ` zig build -Doptimize=ReleaseFast `
2+ 2 . Install Binaryen https://github.com/WebAssembly/binaryen
3+ 3 . Run ` zig build -Doptimize=ReleaseFast `
4+ 4 . Run ` wasm-opt zig-out/bin/zig.wasm -O3 -o zig-out/bin/zig.wasm --all-features --strip-dwarf --strip-debug --vacuum `
You can’t perform that action at this time.
0 commit comments