mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-05-24 13:50:11 +00:00
The previous runtime_detect.zig called std.zig.system.resolveTargetQuery which pulled in the entire Zig target/CPU model table infrastructure for every architecture (~4,000 symbols, ~175 KB of data tables, ~130 KB of code). This bloated the binary by ~500 KB and shifted code layout enough to cause a measurable icache/branch-predictor regression in unrelated hot paths like the terminal parser (~20% more cycles for identical instruction counts). Replace with minimal, direct CPU feature detection per architecture: CPUID + XGETBV inline assembly on x86, sysctlbyname on Darwin AArch64, and getauxval/prctl via std.os.linux (direct syscalls, no libc) on Linux for AArch64, PPC, S390x, RISC-V, and LoongArch. Split into per-architecture files under src/detect/ for maintainability.