|
2026-09-24
| ||
| 00:55 | • Ticket [073e11ce05] Size-gate the syntax highlighter: plain text past a threshold status still Closed with 1 other change artifact: 334550526b user: zeitgeist | |
|
2026-08-31
| ||
| 15:32 | • Closed ticket [073e11ce05]. artifact: 09ce4dcb49 user: ai-local | |
| 12:12 | • New ticket [073e11ce05]. artifact: 8edee5e56e user: ai-local | |
Size-gate the syntax highlighter: plain text past a threshold
The cost tracks TOKEN DENSITY, not file size, which is the tell: src/sqlite.h.in is the largest file at 559KB but the fastest at 208ms (mostly doc comments), while src/btree.c is 407KB of dense C at 490ms and select.c 337KB at 474ms. Highlighting dominates, not blob retrieval.
Past a threshold, skip the lexer and emit a plain
. Chroma emits a span per token, so this removes both the render cost and most of the 5.7x HTML blowup (btree.c: 407KB source becomes 2,335,223 bytes of HTML). GitHub does exactly this for large files, so the degradation is a known, expected one.This is the cheapest large-file fix and the only one that helps the FIRST view — a cache cannot. It is complementary to the highlight cache (9e53a2d9) and is subsumed later by windowing (a82ff129), which highlights only the visible window.
Acceptance: a file past the threshold renders in well under 100ms as plain text with a visible notice saying why; below the threshold nothing changes; the threshold is one named constant.
Landed in f4e226e5 then deliberately narrowed in 937b10d6. At 256KB it turned ten of sqlite's src files permanently grey, which trades the feature for the fix — the owner was right to push back. Now a 2MB safety valve that no real file hits; windowing (a82ff129) removed the need for a threshold at all. Vestigial and removable.