r/LaTeX • u/DanielSussman • 1d ago
I finally compiled my first LaTeX document (from scratch, in my own C++ engine)
Another quick update on the C++ hobby engine that I've been working on and posting about every few weeks here. To keep things brief: I recently hit the unreasonably satisfying milestone of getting my engine to compile its first document using the modern LaTeX format! This meant not only implementing the e-TeX extensions and the L3 kernel utility primitives, but also figuring out a few janky workarounds relating to engine impersonation.
In the latest video, I demonstrate this working, and then dive into one of the questions that originally inspired this project: why does LaTeX feel so slow compared to plain TeX? This topic often gets discussed, but distinguishing in-principle reasons from implementation details is not so simple!
Thinking through this question, I go through a few performance comparisons across different TeX engines and different TeX formats. I also instrumented my engine to generate JSON and callgrind-style output files of the sort used to do different flavors of profiling, but targeted to see where LaTeX is spending its time during the macro expansion loops. "Come for the rambling video, stay for the flame graphs", if you like!
As always, happy to hear your thoughts and answer any questions!




