ASCII export is quadratic; exporters re-parse regex literals on every use #206

open cmc opened this on 2026-11-22 07:11 UTC · feature · milestone Backlog

Discussion

cmc 2026-11-22 07:11 UTC

Severity: Low.

ASCII export takes 1.65 s for 100 kB and 12.8 s for 300 kB; ASCIIRenderer.definition walks the whole tree per footnote reference (Sources/OrgCore/Export/ASCIIExport.swift:1369-1370), and it is still superlinear without footnotes (1.07 s, 7.94 s). OrgCore has 197 inline regex literals, none static, each parsed when its line runs (seen in a profile under Sources/OrgCore/Export/LaTeXExport.swift:1875). For reference HTML is 1.25 s per MB, Markdown 1.2 s, LaTeX about 5 s, ODT about 4 s. Collect footnote definitions once and move hot regexes into static let.

From the performance review, docs/review-2026-11-21.md (#96).

Platforms: macOS, iOS.