mirror of
https://github.com/storytold/wordcraft.git
synced 2026-10-27 03:47:09 -06:00
Found while timing US government documents against Word for Windows. Before: every internal link (#bookmark: a linked table of contents, cross-references) found its bookmark by walking every paragraph of the document, so export time grew with links x length: NIH's 67-page protocol template (297 links) took 10.6 s to export as PDF. After: the bookmark positions are gathered once per export (the first bookmark of a name still wins). The same file exports in 0.9 s with identical text and links. internal_links_export_in_linear_time guards it (the old code took 12x as long for 4x the document). Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>