wasm

command
v1.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

WebAssembly build and size benchmarks

The harness builds the existing benchmark/binary_size examples cprintf, println, and fmtprintf, plus the dynamic reflectcall fixture, with LLGo for all five supported execution entries: J32/GoJS, W32/raw wasip1, J32/Emscripten, J64/Emscripten Memory64, and W32/WASI. Each example/profile records the Wasm module size, generated JavaScript glue size (zero when absent), and selected build times. These are build/size measurements, not runtime or official-Go ABI acceptance.

Official Go size references cover println, fmtprintf, and reflectcall on js/wasm and wasip1/wasm. There is no official-Go cprintf reference: that example calls C printf through LLGo's C interop, which official Go does not provide on wasm.

The existing unqualified metric names continue to mean println, preserving its benchmark history. The cprintf/, fmtprintf/, and reflectcall/ prefixes identify the other examples. Artifacts are stored separately for every example, profile, and compiler.

From the repository root, with the usual LLVM, Emscripten and Binaryen tools:

benchmark/wasm/run.sh "$PWD" /tmp/llgo-wasm-bench /tmp/llgo-wasm-bench-results

An optional fourth argument selects a different repository checkout for benchmark fixtures. CI uses this when measuring a pull request base, so both compilers see the current benchmark sources even when the pull request adds a new fixture:

benchmark/wasm/run.sh /path/to/base /tmp/llgo-wasm-base /tmp/llgo-wasm-base-results "$PWD"

The result directory is replaced on each run; use a dedicated output directory. To reuse a compiler already built for the source revision:

go run ./benchmark/wasm -root "$PWD" -llgo /path/to/llgo \
  -out /tmp/llgo-wasm-bench-results -build-runs 1

The println profile builds have one warm-up followed by measured builds; the CLI defaults to three measurements and reports their median. cprintf and fmtprintf are size-only cases and build once per profile. Both the named W32/WASI target and raw GOOS=wasip1 GOARCH=wasm entry use the typed-bridge fallback, and the harness records both module sizes. To expose its compile cost without duplicating an equivalent timed build, reflectcall times only the named W32/WASI entry; JavaScript profiles remain size-only. With LLGO_WASM_BENCH_BUILD_RUNS=1, CI performs 26 LLGo builds and six official-Go reference builds per revision. A single CI timing sample is noisier than the default median, but base and head run sequentially with the same fixtures and settings on one runner.

The existing WebAssembly benchmark job tests this harness and measures both PR base and head, publishing their results through .github/llgo-wasm-benchmark.yml.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL