bench: add WASM init and startup timing benchmarks#52
Conversation
Adds bench/startup.bench.ts with 6 cases covering cold compile, instantiation, createTermNative, createInputNative, createTerm, and full module-to-first-render startup time. Also exports `bytes` from wasm.ts so the compile step can be benchmarked independently. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
commit: |
Merging this PR will improve performance by 49.3%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| 🆕 | WallTime | time to first render |
N/A | 271.7 ms | N/A |
| 🆕 | WallTime | createTerm |
N/A | 271.2 ms | N/A |
| ⚡ | Simulation | long input burst (200 bytes) |
1,249.6 µs | 980.1 µs | +27.5% |
| ⚡ | Simulation | large list (50 items) |
618.5 µs | 409.4 µs | +51.07% |
| ⚡ | Simulation | printable ASCII (single char) |
153.2 µs | 88.7 µs | +72.76% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing bench/startup-timing (a44157b) with main (4139212)
|
benchmark seems to be a V8 de-opt due to all the benchmarks running in a shared process? digging into it Edit: 🤞 hopefully addressed by splitting the startup benchmark to a separate process in 6eb4995 Edit v2: yeah, fixed it! |
|
On the first commit:
Dunno how you feel about it, but for-profit companies whom we are paying good money to use their tools that permanently attach advertisements to our repo by injecting git metadata into commits is a practice I really find off-putting. So much so that I added it to AGENTS.md https://github.com/bombshell-dev/clayterm/blob/main/AGENTS.md#commit-and-pr-conventions 😄 Any chance you can remove that when squashing? |
|
Two more "first-to-x" benchmarks we should consider before splitting out the wasm modules
|
Two new benchmarks:
createTermandrender-minimal, added as fixtures inbench/fixtures/. New CI job runs these oncodspeed-macrowithmode: walltimeto measure the full E2E perf.Updated
benchmark.ymlwith a single build job where artifacts are shared between simulation + walltime runs. Also pinned SHAs.