Sizes: a medium HTML article is ~90 KB with 12 code blocks; a large one is ~310 KB with 40. A medium Markdown document is ~26 KB (60 sections), a large one ~230 KB (400 sections). (nuevo) marks what changed in the optimization pass of 2026-10-11; the deltas are measured with the old and the new code alternating on the same session, which the single-run noise of this machine demands.
Extraction (fetch → Markdown) (nuevo: -12 a -37%)
| Benchmark | Before | After | Δ |
|---|---|---|---|
| article small (~15 KB) | 5.3 ms | 4.7 ms | -12% |
| article medium (~90 KB) | 25.7 ms | 16.1 ms | -37% |
| article large (~310 KB) | — | ~40 ms (count=3) | -30% |
| chrome-heavy (~10 KB, 40 navs) | 1.2 ms | ~1.1 ms | ~-10% |
| Markdown passthrough (~300 KB) | 4.4 ms | 4.5 ms | ~0% |
Load path (cache vs no cache) (sin cambio)
| Benchmark | Time | Allocs |
|---|---|---|
| local file (~200 KB md) | 3.9 ms | 31 |
| loopback HTTP, cache off | 15.5 ms | 26 K |
| cache miss (fetch + write) | 15.8 ms | 27 K |
| cache hit (disk, no network) | 2.1 ms | 17 |
| cache put+get (26 KB page) | 0.25 ms (347 MB/s) | 44 |
Cache vs no cache is ~7.5x on this path (15.8 → 2.1 ms): the cache turns
“open instantly” into a disk read plus one sanitize pass over 26 KB, with 17
allocations. The hit path does no network, no parsing and no rendering of the
HTML — the Markdown was stored already extracted.
Render (Markdown → ANSI) (nuevo: -15%)
| Benchmark | Before | After | Δ |
|---|---|---|---|
| sample fixture, 80 cols | 0.24 ms | 0.18 ms | ~-20% |
| medium doc, 100 cols | 2.69 ms | 2.28 ms | -15% |
| large doc, 100 cols | 20.8 ms | 17.5 ms | -16% |
| large doc, 200 cols | 25.0 ms | ~19 ms | ~-24% |
| code-heavy, 5 / 20 / 80 blocks | 1.8 / 7.0 / 28 ms | 1.5 / 6.4 / 22 ms | -15/-9/-22% |
| re-render (chroma memoized) | 6.7 ms | ~6.5 ms | ~-3% |
| link mode: footnotes / inline / hidden | 2.9 / 3.0 / 2.6 ms | ~2.1-2.3 / 2.2-2.3 / 1.9 | ~-25% |
Interaction (what a keypress costs) (nuevo: search -65%)
| Benchmark | Before | After | Δ |
|---|---|---|---|
| scroll keys (j k d u G g) | ~100 ns | ~100 ns | 0 |
| tab (link focus) | 354 ns | ~330 ns | ~0 |
full screen draw (render) | 97 µs | ~80 µs | ~-15% |
| resize (re-render at new width) | 8.0 ms | ~5 ms | ~-30% |
| in-page search (300 sections) | 53.8 ms, 7.7 K allocs | ~31 ms, 99 allocs | -42%, -99% allocs |
| follow a link (load + render) | 3.6 ms | ~3.5 ms | ~0 |
| long document (1500 sections, load + 3 jumps) | 187 ms | ~160 ms | ~-15% |
| headless session open + close | 93.6 ms | ~93 ms | ~0 |
| 8 keys through a session | 1.7 µs | ~1.7 µs | 0 |
Store and search (nuevo: findMatches -48%)
| Benchmark | Before | After | Δ |
|---|---|---|---|
findMatches (230 KB doc) | 20.9 ms, 896 allocs | 10.8 ms, 10 allocs | -48%, -99% allocs |
| history: 100 / 1000 / 5000 entries | 0.20 / 1.6 / 8.0 ms | ~0.17 / 1.4 / 7.5 ms | ~-5% |
| history append | 25 µs | ~40 µs | noise |
| bookmarks: 500 entries | 0.58 ms | ~0.49 ms | ~-15% |
The interactive path stays what it was: ~100 ns per key with zero allocations, and a cached page open stays 2 ms. Those were never the problem.