[luatex] Removing the zero-initialization of an array can speedup LuaTeX on plain TeX document by 25%
Hans Hagen
j.hagen at xs4all.nl
Sun Sep 1 10:07:38 CEST 2024
On 9/1/2024 2:28 AM, Reinhard Kotucha via luatex wrote:
> 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.
Isn't there also that file that uses \pdfglyphtounicode ? I don't use it
but loading the 50 K lines file could be sped up a bit.
> 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.
So as soon as context processes a "Hello World" faster than say latex
it's a better system? Alas luametatex needs .46 sec on windows 10 (as
does luatex), .39 on the linux subsystem, .36 on bare metal linux (all
the same 7th gen intel 2018 laptops). I did numerous performance tests
over time (and wrote about it) and one has to test on real (more
complex, more macros, more fonts, more anmything) document to get an
idea about what matters where wrt performance. Even then it's a useless
discussion if one has (wants) to use the system that does the job best
(or fist better).
A \starttext Hello world! \stoptext run gives this (slightly different
setup):
pdftex 0.65
xetex 0.80
luatex 0.89
luametatex 0.61
luametatex cf 0.50
That's the average of 1000 runs and a run includes the management i.e. a
startup script, multipass data processing and such. In the end it
doesn't tell us anything here.
This somewhat slow kpse file lookup is why context had a minimal
distribution for mkii right from the start. Also, the overhead of
loading the lsr files comes with every kpsewhich but that we could get
around using different startup scripts.
But that's all kind of old because SSD combined with operating systems
using abundant memory for directory and file caching helps a lot. Just
measure a decent tex run (or making a format) after a system restart and
then a second time.
> 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.
What system? Luatex or pdftex?
> But it would take much longer with load-unicode-data.tex in the format
> file and a complete TeX Live installation.
Depends on what load-unicode-data does, but a bit bigger format
shouldn't matter that muchm should it? We're not suddenly in the seconds.
> 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.
Add a few populate caches runs and nothing in the background that wastes
the cpu cache,
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
More information about the luatex
mailing list.