mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-09-14 18:01:58 +00:00
This makes `ghostty_terminal_vt_write` on wasm32-freestanding anywhere from 1.4x to 13x faster depending on the input, measured in V8 via Node for Chrome as well as `jsc` for Safari. ## Changes * stream: the batched parse path (bulk UTF-8 decode, print_slice runs) is used even when `build_options.simd` is false. The per-byte loop is now debug-only. * simd/vt: the scalar `utf8DecodeUntilControlSeq` gets a vectorized ASCII bulk path that is compatible with wasm simd128. * style: on wasm, `Style.eql` compares canonical `PackedStyle` forms which is faster by like 11%. On native its slower so we only do this for wasm. * build: wasm targets now default to the `simd128` CPU feature since every browser engine has supported it for years. Opt out with `-Dcpu=generic`. * PACKAGING.md documents the wasm build, including `wasm-opt` notes. ## Benchmarks | Workload | Before | After | Speedup | |---|---|---|---| | ascii | 85 MB/s | 1070 MB/s | 12.5x | | ascii-wrap | 84 MB/s | 1103 MB/s | 13.1x | | clear-redraw | 85 MB/s | 913 MB/s | 10.7x | | scroll | 79 MB/s | 304 MB/s | 3.8x | | cursor | 120 MB/s | 255 MB/s | 2.1x | | utf8 | 99 MB/s | 169 MB/s | 1.7x | | sgr16 | 81 MB/s | 133 MB/s | 1.6x | | sgr-truecolor | 62 MB/s | 88 MB/s | 1.4x | End result: wasm at roughly 50-85% of the native ReleaseFast+SIMD build on the same workloads. Plain ASCII was at 6% of native before. **AI usage:** Lots of Fable help. As always, the human language stuff like this commit and comments were rewritten by me.