New summaries are now made in the free desktop app, which runs on your own computer and handles long YouTube videos and Twitch VODs. Download TooLongLink Desktop

How texlode Achieves 1ms Real-Time Recompilation in LuaTeX by Caching at the Paragraph Level

TeX Users Group

Summary:
  • Clemens Lode introduces texlode, a browser-based real-time LaTeX editor that typesets large documents in ~1ms using standard, unmodified LuaTeX.
  • The editor achieves sub-millisecond speeds by leveraging the paragraph-local nature of the Knuth-Plass line-breaking algorithm, recompiling only the edited paragraph on each keystroke while caching the rest of the document.
  • In benchmarks comparing texlode to Typst, texlode scales at $O[1]$ constant time, whereas Typst scales at $O(n)$ due to whole-document state cache invalidations.
  • On a 300-page document, texlode maintains a 0.7ms recompile speed compared to Typst's 214ms latency.
  • Sub-millisecond compilation enables advanced real-time layout features, including full-book float placement, orphan/widow constraint balancing, and evolutionary algorithm-based page tuning.

texlode vs. Typst compilation speeds across varying document page sizes
texlode vs. Typst compilation speeds across varying document page sizes [ 00:18:10 ]

Introduction and Motivation [00:00:37]

Evolution of Real-Time TeX Editors [00:04:55]

Timeline and summary of prior attempts to bridge the gap in real-time TeX rendering
Timeline and summary of prior attempts to bridge the gap in real-time TeX rendering [ 00:07:48 ]

The texlode Architecture and Optimization Strategy [00:08:57]

Recompilation benchmark limits across various paragraph lengths in LuaTeX
Recompilation benchmark limits across various paragraph lengths in LuaTeX [ 00:10:00 ]

Live Demonstration of the texlode Editor [00:14:54]

The texlode user interface showing side-by-side editing and real-time layout rendering
The texlode user interface showing side-by-side editing and real-time layout rendering [ 00:15:09 ]

Performance Benchmarks: texlode vs. Typst [00:18:09]

Comparison of compilation scaling speeds between texlode and Typst versions
Comparison of compilation scaling speeds between texlode and Typst versions [ 00:18:10 ]

Future Possibilities of Sub-Millisecond Recompilation [00:21:01]

Q&A Session [00:24:20]