arXiv · 2612.03634
Evaluating Stack Switching in WebAssembly
Abstract
Compiling control-flow abstractions like light-weight threads, async/await, and generators to WebAssembly typically requires whole-program transformations that complicate compilation and impose runtime and code-size costs. WasmFX extends WebAssembly with native stack switching based on effect handlers, providing a common foundation for these features. We evaluate WasmFX backends for C, Go, Kotlin, and OCaml and implementation trade-offs in the V8, Wasmtime, and Wizard engines. We compare performance against existing compilation strategies when using these engines. On artificial microbenchmarks involving tight context-switching loops, existing techniques sometimes outperform WasmFX. However, as the stack becomes deeper, WasmFX gains a substantial advantage over Asyncify, the transformation used by our C baseline to emulate stack switching. Even with substantial scope for further optimisation, current WasmFX implementations deliver competitive performance on macrobenchmarks without requiring whole-program transformations.
Explore related subjects
Keep this discovery
Explore connections, maps & timelines
Ezra Cooper, Amy Yin, Frank Emrich, Daniel Hillerström, Andreas Rossberg, Carlos Amedee, Zalim Bashorov, Francis McCabe, Thibaud Michaud, Cherry Mui, Aleksandr Shefer, Veronika Sirotkina, Ben L. Titzer, Ricky Vetter, Jérôme Vouillon, Conrad Watt, Sam Lindley. 2026-12-02. Evaluating Stack Switching in WebAssembly. https://searcharxiv.org/abs/2612.03634
Citations retain the original authors and DOI and include this site’s record URL. If this discovery service contributed to your research, you can also cite Search arXiv by Indiciae: BibTeX · RIS.