luatex and slow file searches for unknown files
MiKTeX source code moved to GitHub
Brought to you by:
csc
When I compile this document with lualatex (0.79.1)
\documentclass{article} \begin{document} \InputIfFileExists{unknown}{true}{false} \end{document}
I can see in the process monitor around 2000 events with "NAME NOT FOUND". Lualatex is really looking almost everywhere for the file. One example line of the monitor is:
13:03:53,3383710 lualatex.exe 7056 QueryOpen D:\MiKTeX2.9\tex\latex\algorithms\unknown.tex NAME NOT FOUND 0.0000105
pdflatex or xelatex creates only one line:
13:05:19,1731388 pdflatex.exe 5940 QueryOpen G:\Z-Test\unknown.tex NAME NOT FOUND 0.0000094
It looks as if luatex is not relying on the FNDB when it can't find a font.
I can't test if the problem is specific to the new luatex version or did always exists.
This files searches are quite problematic as with fontspec lualatex has to look for a lot of optional files. In one case I could cut down the compilation time from 12 to 2 seconds simply by removing an equivalent of \InputIfFileExists
in the fontspec code.
I have checked the source code: luatex always tries hard to find an \input or \read file. In MiKTeX land, this means that the disk is searched.
Diff:
In TeXlive lualatex (and pdflatex) does some disk search too. But one can forbid this for most texmf trees by using "!!" in the texmf.cnf. So in texlive I have only around 50 events compared to 2000 in miktex -- and this isn't a full miktex installation. Could you tell me where in the sources the disk search is triggered? Then I could discuss it on the luatex list.
Last edit: U_Fischer 2015-03-25
The search is triggered in the function luatex_find_read_file which is defined in the source file texfileio.w.
I have attached a preliminary bug fix for luatex_find_read_file in MiKTeX.
Last edit: Christian Schenk 2015-03-25
Seeing your patch: Is there a need or would it make sense if the luatex source are adapted somehow? Or is this a patch that you would have to do always in the miktex sources?
If the bug (I think it is a luatex bug) isn't fixed upstream, it is relatively easy for
me to apply the patch to any future luatex release.
If the bug fix is okay, I will send the patch to the luatex-dev list. Please feel free to discuss the issue on the luatex user list.
If you don't object, I will close the ticket (the bug has been fixed).
I will send a patch to the luatex-dev mailing list within the next days.
Thank you for the valued bug report!
Naturally I don't object. I always thought that you are the only one who can close bug reports. If not I will have to check some of my reports which have been fixed in the meantime ...
Thank you very much for the fast fix - the gain time is really noticable. I will check the luatex list and if I can do something to clarify the problem I will do it, but imho it is at first best if there is no middleman confusing things.