[luatex] Removing the zero-initialization of an array can speedup LuaTeX on plain TeX document by 25%
Reinhard Kotucha
reinhard.kotucha at gmx.de
Tue Sep 3 03:00:27 CEST 2024
On 2024-09-01 at 10:07:38 +0200, Hans Hagen wrote:
> 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)
Just out of curiosity, how do you determine runtime on Windows?
> 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.
Wouldn't it be more appropriate to determine the minimum time instead
of the average? A predictable program requires a certain number of
clock cycles, independent of when the program is invoked. If the time
is greater than the minimum, the measurement is certainly distorted by
other processes. There are a lot of kernel processes running in the
background, and Firefox permanently creates files even if you don't
touch it. Don't know why.
> This somewhat slow kpse file lookup is why context had a minimal
> distribution for mkii right from the start.
Sure, but no option for LaTeX. TeX Live is modular but LaTeX users
can't know in advance what they need.
> Also, the overhead of loading the lsr files comes with every
> kpsewhich but that we could get around using different startup
> scripts.
At least if you use other scripting languages than texlua. kpsewhich
could be more efficient if it doesn't read the ls-R files when only
variable expansion is requested.
> 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.
There is no need to restart a Linux system. Run this as root:
sync && echo 3 > /proc/sys/vm/drop_caches
I mention it here because it's the fastest and most convenient way to
drop the caches though many people aren't aware of this solution.
I can read cached files with a transfer rate of 12 GB/s on my main
machine but my Web server is a Raspberry Pi 3B with limited resources.
On this server PDF files are created on-the-fly and the cache might be
filled by other processes between the TeX runs. In this case file
sizes matter.
> > 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?
With Knuth's TeX (DVI output). I can compile it with pdfTeX in less
than 600 ms, and with LuaTeX within one second.
A "hello world\bye" takes 13 ms with Knuth's TeX (DVI output), less
than 120 ms with pdfTeX and less then 95 ms with LuaTeX.
pdfTeX and LuaTeX have to embed the fonts which takes some time.
Obviously LuaTeX is faster than pdfTeX when processing small files
while the opposite is true for large files.
I suppose that the reason is that LuaTeX has to make more nodes
accessible if files are large and for small files it benefits from the
fact that it loads hyphenation patterns for only one language.
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.