I began Ghostty performance work with obvious SIMD opportunities: filtering control sequences and decoding UTF-8. These parsing optimizations sit alongside the broader measurements and results on terminal performance evidence.
I reported SIMD parsing was 16x faster for complex UTF-8 on aarch64.
I said SIMD parsing was faster than a straight up memcpy.
I said the speed increase was even greater on x86_64 with AVX2 or above, since they have much wider vector registers.
I described the benchmark’s “memcpy” mode using the exact phrase: The speed of libc memcpy into a pre-allocated buffer.
I described “scalar” as the old non-SIMD approach currently active in Ghostty.
I described “simd” this way: Use the SIMD-based algorithms with the best possible supported ISA for your CPU (runtime detected).
I clarified that these numbers are purely our parsing speed; adding terminal-state overhead such as line wrapping and grapheme clustering makes the real-world speedup only 2x.
I said terminal-state handling had NOT been optimized yet and that I needed to follow up: I need to get back to that.
I said, “If you have a partial read it’s fine.” I described it as, “It’s like a giant state machine.” I said, “When you get the next bunch of bytes just send those in too.” I added, “Well process them with SIMD and advance the state machine.”
I described OSC parsing in libghostty as our last non-SIMD optimized VT stream path.
I said OSCs are usually small and that “it just never showed up on benchmarks.”
I applied SIMD to OSC parsing because Kitty clipboard was “potentially passing megabytes of data”; OSC parsing “it got the SIMD treatment.”
I shared a link about the SIMD treatment of OSC parsing: https://t.co/JbsTM0Jy7o.
Related: simd unicode processing, terminal performance evidence, terminal performance engineering