Skip to Content
marmot

Three gaps in build-time tooling and the playground, against SPEC 3c (build time 0.8x of Go) and the playground targets. The targets are a Run under 3 s in Chrome and under 8 s in Firefox once cached. A first visit is limited only by the download. For each gap: the evidence, techniques with sources, the expected gain for marmot, the cost, the risk, and a pick.

Gap 1: cold dev builds of small programs

Evidence. Linux scoreboard of 2026-11-12, 45 programs. Cold means -nocache for marmot and an empty cache for Go. marmot dev cold build geomean 1.55x Go, marmot -release 0.90x. Examples: conv 1.60x dev against 0.60x release, fib 1.21x against 0.46x. Warm builds are 0.68x (dev) and 0.70x (release), inside the goal. A release build compiles only what the program reaches (whole program), while a dev build compiles every function of every imported package. So most of the cold dev time goes to code that the program never calls.

Techniques.

  • Lazy, reference-driven analysis. Zig analyzes only declarations that are referenced from the roots, and unreferenced functions are never compiled. The same dependency records drive its incremental compilation. Sources: https://matklad.github.io/2023/02/10/how-a-zig-ide-could-work.html, https://ziggit.dev/t/how-zig-incremental-compilation-is-implemented-internally/3543/2
  • Reachability before code generation. Go's linker marks every symbol reachable from main.main, the init functions and runtime roots, through calls, function values and interface method signatures. It has a relaxed mode when reflection's method lookup is reachable (cmd/link/internal/ld/deadcode.go). Go does this after compilation, so it saves link and size, not compile time. Rapid Type Analysis gives a sound call graph for interface calls at low cost. The source is Bacon and Sweeney, OOPSLA 1996, "Fast static analysis of C++ virtual function calls". golang.org/x/tools/go/callgraph/rta implements it for Go SSA, which marmot already builds.
  • Prebuilt standard library. Go shipped compiled standard library archives until Go 1.20 (Go 1.20 release notes). It dropped them to make the distribution about two thirds smaller, and relies on the build cache. marmot has install-std for the same purpose.

Expected gain for marmot. Dev code only for functions that RTA reaches from main, the init functions and runtime roots. This should bring cold dev builds near the release cold numbers for the codegen share: from 1.55x toward 0.7 to 0.9x Go. This is an estimate. The release builds show the effect of reachability, but they also differ in the optimizer pipeline.

Cost. Medium. Per-package object caching would become per-program for the pruned packages. So a cache entry needs the set of reachable functions in its key. Or the cache keeps full package objects, and the pruning applies only to cold builds without a cached object.

Risk. Reflection (MethodByName), plugin-like loading and linkname can reach functions that RTA does not see. The fallback is Go's rule: when method lookup by name is reachable, keep every exported method of reachable types.

Pick. Measure first: the share of cold dev build time spent on unreachable functions. Count the generated functions against the RTA reachable ones, for the 45 programs. If over half, build RTA pruning for cold dev builds behind a switch.

Gap 2: the playground's first Run in browsers without JSPI

Evidence. Measured tonight: Firefox without JSPI 13 to 25 s for an edited program, of which the Asyncify pass in binaryen.js is 10 to 21 s. Chrome with Asyncify forced 4 to 9 s. With JSPI (Chrome, Firefox 153 and later) it is 1 to 3 s. Every function that can allocate reaches a switch on wasm (the collector unwinds the stack to scan it), so Asyncify instruments nearly all of them. An only-list from a call graph and ignore-indirect gave no gain.

Techniques.

  • Asyncify itself. Binaryen's design aims at low but non-zero overhead and reports code growth of about 50% in a 2019 port (Doom 3). Its cost scales with the instrumented code. Source: https://kripken.github.io/blog/wasm/2019/07/16/asyncify.html
  • WebAssembly stack switching (formerly typed continuations, phase 3). It removes both Asyncify and the promise cost of JSPI. Sources: the PLDI 2026 paper on the verified design (https://iris-project.org/pdfs/2026-pldi-iriswasmfx.pdf) and "Continuing WebAssembly with Effect Handlers" (OOPSLA 2023). No browser ships it yet.
  • A precise stack map for the collector on wasm (the approach of Go's own wasm port, which keeps its own stack in linear memory). The unwind for scanning would then not be needed, and allocation would not reach a switch.

Expected gain. For the 13 to 25 s: only stack switching or a collector without the unwind cuts the pass. A precise stack on wasm would let the Asyncify pass skip allocation paths. The direct-call-only bound found tonight is about 700 of 4450 functions instrumented, so the pass could drop by up to about 5x. That is an upper bound, because indirect calls still count.

Cost. High (runtime and compiler work for the collector on wasm). Stack switching costs little for marmot once browsers ship it: the JSPI host already has the shape.

Risk. Older browsers keep Asyncify in any case. Safari's JSPI plans are not public.

Pick. No new work now. Track stack switching in Firefox and Chrome, and use it behind the same feature test as JSPI when it ships. Since current Chrome and Firefox take the JSPI path, this gap affects fewer users each month.

Gap 3: the playground's first visit

Evidence. A first visit downloads about 25 MB, after the gzip of the archives. The backend wasm is 9.2 MB (zstd from the server), the standard library 5.4 MB and the front end wasm 5.0 MB. binaryen.js is 2.2 MB, and the front end file system 2.4 MB. At 20 Mbit/s the last file arrives after about 8 s. On a reload, binaryen.js still costs about 0.75 s to evaluate in Chrome. The page imports it from a blob URL, and its wasm is embedded in the JavaScript. So it is compiled again on each visit.

Techniques.

  • Brotli at level 11 for precompressed static files. It gives smaller files than zstd at the cost of compression time, which happens once at build. Measured tonight on these files: backend 9.16 to 6.6 MB, front end 5.04 to 3.7 MB, binaryen.js 2.24 to 1.4 MB. Source for the general result: https://blog.openreplay.com/gzip-vs-brotli-vs-zstd-web-compression/
  • Wasm code caching. V8 caches the optimized code of a module compiled with compileStreaming or instantiateStreaming, also in workers, keyed by the URL (https://v8.dev/blog/wasm-code-caching). The page already compiles the backend with compileStreaming, and it starts in 30 ms on a reload. binaryen's wasm is inside its JavaScript, so it gets no code cache.
  • Lazy loading by need. The examples already run prebuilt. The tools load on the first edit.

Expected gain. Brotli: about 8 MB less, so a first visit of about 17 MB, 3 s less at 20 Mbit/s. A separate binaryen.wasm compiled with compileStreaming: most of the 0.75 s on a reload.

Cost. Low for both. Brotli needs a test of precompressed files with a Content-Encoding header on the static host. The separate binaryen.wasm needs a build of binaryen.js without the embedded wasm (its npm package ships the single-file form).

Risk. Low. If the host does not serve precompressed files with Content-Encoding, the page can unpack brotli itself only where DecompressionStream supports it.

Pick. 1) binaryen.wasm as a separate file through compileStreaming, 2) brotli for the large files once the host test passes.

Picks

  1. Gap 3, binaryen.wasm through compileStreaming and brotli: low cost, measurable tomorrow.
  2. Gap 1, measure the unreachable share of cold dev builds, then decide on RTA pruning with the frontend.

On this page

Was this page helpful?

Report an issueOpen issues