[luatex] Identifying why LuaTeX 2023 is slower than LuaTeX 2022
Hans Hagen
j.hagen at xs4all.nl
Mon Aug 28 18:34:16 CEST 2023
On 8/28/2023 5:43 PM, Paulo Roberto Massa Cereda wrote:
> Thanks for the feedback, Hans! Apologies for the "vague" context, I
> was in a hurry. I will try to provide more details as follows:
>
> My initial test was:
>
> --------8<--------
> \documentclass{article}
>
> \usepackage{fontspec}
>
> \setmainfont[
> Extension=.ttf,
> Path=./fonts/,
> UprightFont=*-Regular,
> BoldFont=*-Bold,
> ItalicFont=*-Italic,
> BoldItalicFont=*-BoldItalic
> ]{JetBrainsMono}
>
> \begin{document}
>
> Hello world.
>
> \end{document}
So that is mostly measuring start up time.
There is no real big difference between jetbrain regular and for
instance dejavu sans mono):
1000 lorum paragraphs (standard 12pt context layout):
% jetbrain : 200 pages 1.4 sec
% dejavu : 200 pages 1.2 sec
if we just process the font (hbox)
% jetbrain : 0.39 sec (0.15) sec for 200 pages
% dejavu : 0.36 sec (0.15) sec for 200 pages
in base mode:
% jetbrain : 0.15 sec for 200 pages
% dejavu : 0.15 sec for 200 pages
(windows 10, luametatex with context, 2017 laptop with Intel(R) Xeon(R)
CPU E3-1505M v6 @ 3.00GHz)
Just to give you some comparison.
> --------8<--------
>
> JetBrains Mono was obtained from here: https://www.jetbrains.com/lp/mono/
>
> By "cold cache" (and apologies in advance for probably using the wrong
> term for describing), I was referring to deleting
>
> texmf-var/luatex-cache
>
> before each benchmark run. I did this with both TL 2022 and TL 2023.
>
> Then I tried with an actual document. I had Lorem Ipsum paragraphs
> replicated more than 1000 times:
>
> ➜ wc -l test.tex
> 2499 test.tex
>
> ➜ hyperfine -L year 2022,2023 --warmup 2
> 'texlive/{year}/bin/x86_64-linux/lualatex test.tex'
> Benchmark 1: texlive/2022/bin/x86_64-linux/lualatex test.tex
> Time (mean ± σ): 2.881 s ± 0.021 s [User: 2.771 s, System: 0.108 s]
> Range (min … max): 2.848 s … 2.907 s 10 runs
>
> Benchmark 2: texlive/2023/bin/x86_64-linux/lualatex test.tex
> Time (mean ± σ): 5.814 s ± 0.059 s [User: 5.675 s, System: 0.128 s]
> Range (min … max): 5.760 s … 5.910 s 10 runs
hm, so startup time differences can be neglected
> Summary
> texlive/2022/bin/x86_64-linux/lualatex test.tex ran
> 2.02 ± 0.03 times faster than
> texlive/2023/bin/x86_64-linux/lualatex test.tex
>
> For HarfBuzz, I had the OTF font example above with:
That could be changes in that library, right?
> \setmainfont[
> Extension=.ttf,
> Path=./fonts/,
> UprightFont=*-Regular,
> BoldFont=*-Bold,
> ItalicFont=*-Italic,
> BoldItalicFont=*-BoldItalic,
> Renderer=HarfBuzz
> ]{JetBrainsMono}
>
> For the normalize thing one, I had:
>
> \setmainfont[
> Extension=.ttf,
> Path=./fonts/,
> UprightFont=*-Regular,
> BoldFont=*-Bold,
> ItalicFont=*-Italic,
> BoldItalicFont=*-BoldItalic,
> RawFeature=-normalize
> ]{JetBrainsMono}
>
> Marcel suggested me to update TL2022 luaotfload-tool to the latest
> version as well, so I did:
>
> ➜ texlive/2022/bin/x86_64-linux/luaotfload-tool --version | grep
> "luaotfload-tool version"
> luaotfload-tool version: "3.24"
>
> ➜ texlive/2023/bin/x86_64-linux/luaotfload-tool --version | grep
> "luaotfload-tool version"
> luaotfload-tool version: "3.24"
>
> ➜ hyperfine -L year 2022,2023 --warmup 2
> 'texlive/{year}/bin/x86_64-linux/lualatex test.tex'
> Benchmark 1: texlive/2022/bin/x86_64-linux/lualatex test.tex
> Time (mean ± σ): 689.6 ms ± 2.0 ms [User: 588.9 ms, System: 100.1 ms]
> Range (min … max): 687.3 ms … 693.6 ms 10 runs
>
> Benchmark 2: texlive/2023/bin/x86_64-linux/lualatex test.tex
> Time (mean ± σ): 1.264 s ± 0.007 s [User: 1.151 s, System: 0.112 s]
> Range (min … max): 1.254 s … 1.277 s 10 runs
>
> Summary
> texlive/2022/bin/x86_64-linux/lualatex test.tex ran
> 1.83 ± 0.01 times faster than
> texlive/2023/bin/x86_64-linux/lualatex test.tex
>
> I also tried with \usepackage[T1]{fontenc}:
>
> ➜ hyperfine -L year 2022,2023 --warmup 2
> 'texlive/{year}/bin/x86_64-linux/lualatex test.tex'
> Benchmark 1: texlive/2022/bin/x86_64-linux/lualatex test.tex
> Time (mean ± σ): 457.4 ms ± 3.1 ms [User: 380.7 ms, System: 76.3 ms]
> Range (min … max): 452.8 ms … 463.6 ms 10 runs
>
> Benchmark 2: texlive/2023/bin/x86_64-linux/lualatex test.tex
> Time (mean ± σ): 893.9 ms ± 8.4 ms [User: 805.5 ms, System: 88.0 ms]
> Range (min … max): 886.8 ms … 915.7 ms 10 runs
>
> Summary
> texlive/2022/bin/x86_64-linux/lualatex test.tex ran
> 1.95 ± 0.02 times faster than
> texlive/2023/bin/x86_64-linux/lualatex test.tex
>
> I can create a GitHub repository with some tests for reproducibilty,
> if it helps.
>
> I will try to compile the sources. Will report soon.
best try that first because it might be that you have a subtoptimal
binary or get bins from
https://dl.contextgarden.net/build/luatex/
(these are generated in the tex live setup so basically for older
linuxes in order to be compatible)
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.