Subject: Re: TeXlive (specifically LuaLaTeX) has become terribly slow

From: Wojtek Kosior <[email-masked]>
Date: Thu, 27 Jul 2023 22:07:12 +0200

I ran lualatex under strace, additionally prepending the time to each
line of output. The new (i.e. after tex-team-next merge this July)
lualatex has *a lot* of lines like this in the output

--8<---------------cut here---------------start------------->8---
Thu Jul 27 09:31:56 PM CEST 2023: access("/home/urz/.guix-home/profile/share/texmf-dist/scripts/context/lua/lualatexquotejobname/lua.lua", R_OK) = -1 ENOENT (No such file or directory)
Thu Jul 27 09:31:56 PM CEST 2023: access("/home/urz/.guix-home/profile/share/texmf-dist/scripts/context/lua/lualatexquotejobname/lua.luatex", R_OK) = -1 ENOENT (No such file or directory)
Thu Jul 27 09:31:56 PM CEST 2023: access("/home/urz/.guix-home/profile/share/texmf-dist/scripts/context/lua/lualatexquotejobname/lua.luc", R_OK) = -1 ENOENT (No such file or directory)
Thu Jul 27 09:31:56 PM CEST 2023: access("/home/urz/.guix-home/profile/share/texmf-dist/scripts/context/lua/lualatexquotejobname/lua.luctex", R_OK) = -1 ENOENT (No such file or directory)
Thu Jul 27 09:31:56 PM CEST 2023: access("/home/urz/.guix-home/profile/share/texmf-dist/scripts/context/lua/lualatexquotejobname/lua.texlua", R_OK) = -1 ENOENT (No such file or directory)
Thu Jul 27 09:31:56 PM CEST 2023: access("/home/urz/.guix-home/profile/share/texmf-dist/scripts/context/lua/lualatexquotejobname/lua.texluc", R_OK) = -1 ENOENT (No such file or directory)
Thu Jul 27 09:31:56 PM CEST 2023: access("/home/urz/.guix-home/profile/share/texmf-dist/scripts/context/lua/lualatexquotejobname/lua.tlu", R_OK) = -1 ENOENT (No such file or directory)
--8<---------------cut here---------------end--------------->8---

The "old" lualetex (i.e. one from before the merge) does not produce
these under strace.

This test has been done (in case anyone's wondering) *after*
bind-mounting the texmf.cnf of texlive-kpathsea as explained in my
previous message.

Hopefully, this will help someone solve this

Wojtek

-- (sig_start)
website: https://koszko.org/koszko.html
fingerprint: E972 7060 E3C5 637C 8A4F  4B42 4BC5 221C 5A79 FD1A
follow me on Fediverse: https://friendica.me/profile/koszko/profile

♥ R29kIGlzIHRoZXJlIGFuZCBsb3ZlcyBtZQ== | ÷ c2luIHNlcGFyYXRlZCBtZSBmcm9tIEhpbQ==
✝ YnV0IEplc3VzIGRpZWQgdG8gc2F2ZSBtZQ== | ? U2hhbGwgSSBiZWNvbWUgSGlzIGZyaWVuZD8=
-- (sig_end)

On Thu, 27 Jul 2023 00:21:42 +0200 Wojtek Kosior <[email-masked]> wrote:

> Hi,
> 
> I think I know what causes a subdirectory of '{' to be used for caches
> — the 'share/texmf-dist/web2c/texmf.cnf' file in the
> texlive-libkpathsea package has a
> 
>     TEXMFROOT = {$GUIX_TEXMF}/..
> 
> line. It's a "runtime path configuration file for kpathsea" and in
> general it supports brace expansion. However, in this case something
> goes wrong. Maybe the expansion is only triggered when there's at least
> one comma in between the braces? Idk. Btw, Guix uses ":" and not a
> comma as path separator in 'GUIX_TEXMF' variable and I have no idea
> whether kpathsea's brace expansion allows ":" to be used instead of ",".
> 
> Still, I'm pretty sure it is this line that causes the '{' directory
> problem — I tried running lualatex after bind-mounting a modified
> texmf.cnf over the one in the store. I replaced that line with
> 
>     TEXMFROOT = $GUIX_TEXMF/..
> 
> and no '{' was created this time. Of course, it only worked because
> GUIX_TEXMF was holding just one path — a general solution would need to
> be different. Just in case, this is the part of texlive-kpathsea
> definition in gnu/packages/tex.scm that prepares 'texmf.cnf':
> 
> ```
>           (add-after 'unpack 'customize-texmf.cnf
>             ;; The default "texmf.cnf" file is provided by this package.
>             ;; Every variable of interest is set relatively to the GUIX_TEXMF
>             ;; environment variable defined via a search path below.
>             ;;
>             ;; This phase must happen before the `configure' phase, because
>             ;; the value of the TEXMFCNF variable (modified along with the
>             ;; SELFAUTOLOC reference below) is used at compile time to
>             ;; generate "paths.h" file.
>             (lambda _
>               (substitute* "texk/kpathsea/texmf.cnf"
>                 (("^TEXMFROOT = .*")
>                  "TEXMFROOT = {$GUIX_TEXMF}/..\n")
>                 (("^TEXMF = .*")
>                  "TEXMF = {$GUIX_TEXMF}\n")
>                 (("\\$SELFAUTOLOC(/share/texmf-dist/web2c)" _ suffix)
>                  (string-append #$output suffix))
>                 ;; Don't truncate lines.
>                 (("^error_line = .*$") "error_line = 254\n")
>                 (("^half_error_line = .*$") "half_error_line = 238\n")
>                 (("^max_print_line = .*$") "max_print_line = 1000\n"))))
> 
> ```
> 
> Unfortunately, changes to 'texmf.cnf' don't affect the running time of
> lualatex — it's still terribly slow
> 
> Wojtek
> 
> -- (sig_start)
> website: https://koszko.org/koszko.html
> fingerprint: E972 7060 E3C5 637C 8A4F  4B42 4BC5 221C 5A79 FD1A
> follow me on Fediverse: https://friendica.me/profile/koszko/profile
> 
> ♥ R29kIGlzIHRoZXJlIGFuZCBsb3ZlcyBtZQ== | ÷ c2luIHNlcGFyYXRlZCBtZSBmcm9tIEhpbQ==
> ✝ YnV0IEplc3VzIGRpZWQgdG8gc2F2ZSBtZQ== | ? U2hhbGwgSSBiZWNvbWUgSGlzIGZyaWVuZD8=
> -- (sig_end)