[luatex] Removing the zero-initialization of an array can speedup LuaTeX on plain TeX document by 25%

Reinhard Kotucha reinhard.kotucha at gmx.de
Sun Sep 1 02:28:04 CEST 2024


On 2024-08-31 at 21:50:33 +0200, Hans Hagen wrote:

 > on 400 10 character exceptions i see no gain (on a 5 year old laptop) as
 > we're in the random runtime measurements; runs only differ in the second
 > decimal so .452 .. .454 which makes it hard to check fo it matters

Regarding performance tests, there are a few things worth to be
mentioned.  You get different results in different environments.
First of all, in TeX Live luatex.ini contains the line

  \input load-unicode-data.tex

This huge file blows up the format file and increases startup time
significantly.  AFAIK it's currently only used by LaTeX and can be safely
removed from all plain TeX formats.

Another point is kpathsea.  It accelerates file lookup significantly
but nowadays TeX Live provides more than 200,000 files and processing
all the ls-R files takes a lot of time too.

The solution is to create a tiny self-contained TeX distribution
on-the-fly which only contains the files needed.

  http://reinhardk.ddns.net/scripts/tex/tinytex/

I recently investigated because there was a talk about a new
typesetting system called "Typst" at TUG-2023.  They claimed that it's
extremely fast, a "hello world" can be compiled within 140 ms.

With the setup decribed above I can compile a "hello world" with
Knuth's TeX within 13 ms and "The TeXbook" (285 pages) in less than
190 ms.

But it would take much longer with load-unicode-data.tex in the format
file and a complete TeX Live installation.

In order to compare performance on different machines it's necessary
to make sure that the environments are comparable.  Especially the
startup time has a significant impact on the results.

Regards,
  Reinhard

--
------------------------------------------------------------------
Reinhard Kotucha                            Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover                    mailto:reinhard.kotucha at gmx.de
------------------------------------------------------------------



More information about the luatex mailing list.