Overview
| Artifact ID: | 8edee5e56e891abc6f0154e4feff3e376608f9acdbe4ff4edd20b999d0d9970f |
|---|---|
| Ticket: | 073e11ce0566ae41edd6f8515773081afbcd54a9
Size-gate the syntax highlighter: plain text past a threshold |
| User & Date: | ai-local on 2026-08-31 12:12:18 |
Changes
- Untracked field cmimetype: "text/x-markdown"
- comment changed to:
highlight.Code has no size gate — every byte of every file is tokenised on every request, with no cache. 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 <pre>. 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.
- priority changed to: "High"
- severity changed to: "Important"
- status changed to: "Open"
- subsystem changed to: "web"
- title changed to:
Size-gate the syntax highlighter: plain text past a threshold
- type changed to: "Feature"