mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 08:02:28 +00:00
The vendored WebGL atlas capped its invisible-glyph cache at 4,096 entries but enforced the cap by clearing it. A terminal steadily above that many distinct (char, bg, fg, style) combinations therefore lost every entry on each cap-th admission, and each following miss re-ran _drawToCache, which is a canvas draw plus a getImageData readback on the renderer thread. Steady-state cost was 4,096 rasterizations per 4,096 admissions rather than one. FourKeyMap has no ordering and no delete, so the two invisible FourKeyMaps and their counter collapse into one insertion-ordered Set of composite keys. Every value in those maps was the same NULL_RASTERIZED_GLYPH, so the key set is the whole cache, and a Set gives both the ordering eviction needs and the removal FourKeyMap cannot do. Overflow now drops the single oldest admission. The key is tagged with its type so char code 49 and the combined string '1' cannot share an entry. Bundles, sourcemaps, and the lockfile hash regenerated with config/scripts/regenerate-xterm-patches.mjs; --check passes. The audit script gains the assertion that distinguishes the two policies: after a fresh fill of the cap, redrawing that whole window rasterizes nothing and redrawing the one variant that aged out rasterizes exactly once. It passes against both shipped bundles in both output modes.