mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-09-20 04:28:06 +00:00
Implements TinyIO for Windows which is used to save binary and runtime costs. As a reminder, binary costs are saved because `std.Io` uses a vtable so compilers can't prune any unused functions, so you pay for the full cost. We can noop unused functions to save. Runtime is saved because there is less state to carry for unused functionality like concurrency primitives. The impl itself is mostly taken from Zig directly. I ran tests on Windows (arm64) and verified everything works as expected so far! Binary size measurements before/after: | Mode | Io owner | ghostty-vt.dll | vs. Threaded | |--------------|-----------------|---------------:|-------------:| | ReleaseFast | std.Io.Threaded | 2,209,280 | | | ReleaseFast | std.Io.failing | 1,815,552 | -393,728 | | ReleaseFast | TinyIo | 1,826,816 | -382,464 | | ReleaseSmall | std.Io.Threaded | 1,541,632 | | | ReleaseSmall | std.Io.failing | 1,190,912 | -350,720 | | ReleaseSmall | TinyIo | 1,199,616 | -342,016 | The runtime savings are relatively small, but 1KB per terminal ain't nothing: | Io owner | Private, +100 terminals | Private, startup | |-----------------|------------------------:|-----------------:| | std.Io.Threaded | +161,845,248 | 782,336 | | TinyIo | +161,742,848 | 729,088 |