I stumbled across a super easy way to profile the compiler using WASI.
$ zig build roc -Dtarget=wasm32-wasi
warning: Cross compilation does not support fuzzing (Only building repro executables)
$ wasmtime --dir=. --profile=guest zig-out/bin/roc.wasm check New-List-Cutoff_10MB.roc
panic: index out of bounds: index 2863311530, len 54242
Unable to dump stack trace: not implemented for Wasm
Unable to dump stack trace: not implemented for Wasm
Profile written to: wasmtime-guest-profile.json
View this profile at https://profiler.firefox.com/.
Error: failed to run main module `zig-out/bin/roc.wasm`
Caused by:
0: failed to invoke command default
1: error while executing at wasm backtrace:
0: 0x50f1 - roc.wasm!posix.abort
1: 0x40da - roc.wasm!debug.defaultPanic
2: 0x4661 - roc.wasm!debug.panicExtra__anon_2328
<snipped>
Then I just opened my browser to https://profiler.firefox.com/
and loaded the generated profile wasmtime-guest-profile.json
Screenshot 2025-07-10 at 15.04.47.png
:smiley:
Last updated: Jul 26 2025 at 12:14 UTC