-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Use luatex in --luaonly mode to query kpsewhich. #19558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
4775421
to
bf71732
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a very clean solution. TeX Live has shipped luatex since at least 2016 and MiKTeX since at least 2017. I think it's possible to install TeX without luatex, so this added dependency should get a mention in the release notes.
Right now it's not a new dependency (we just silently fall back to the old slow path if luatex is not present); the question is indeed whether we want to emit a noisier warning or even just fail in that case and make luatex a hard dependency. (I think there's some appeal to keep dependencies minimal?) |
I'll move this to draft until you decide what to do about the dependency... |
I decided to just mention it in the docs and live with it, it's optional anyways. |
|
thanks, hopefully fixed now |
`luatex --luaonly` runs a *lua* interpreter with relevant tex libraries available, which avoids the overhead of repeatedly initializing kpathsea (the old approach, very slow on macos and windows). An alternative approach would be to use `luatex` followed by `\directlua` calls, but on windows it appears that one needs to use `lualatex` to get a working interactive prompt, and just loading the latex format takes seconds(!). For the simple following benchmark: ```sh python -c 'from pylab import *; mpl.use("pdf"); rcParams["text.usetex"] = True; plot(); savefig("test.pdf", backend="pdf")' ``` On a macos machine, this patch brings runtime from ~4.5s to ~2.5s. On a windows machine, this patch brings runtime from ~6.5s to ~1.7s. We also need to figure out how to best advertise this (do we emit a warning suggesting to install luatex on windows and macos if luatex is not present?).
luatex --luaonly
runs a lua interpreter with relevant tex librariesavailable, which avoids the overhead of repeatedly initializing
kpathsea (the old approach, very slow on macos and windows). An
alternative approach would be to use
luatex
followed by\directlua
calls, but on windows it appears that one needs to use
lualatex
to geta working interactive prompt, and just loading the latex format takes
seconds(!).
For the simple following benchmark:
python -c 'from pylab import *; mpl.use("pdf"); rcParams["text.usetex"] = True; plot(); savefig("test.pdf", backend="pdf")'
On a macos machine, this patch brings runtime from ~4.5s to ~2.5s.
On a windows machine, this patch brings runtime from ~6.5s to ~1.7s.
We also need to figure out how to best advertise this (do we emit a
warning suggesting to install luatex on windows and macos if luatex is
not present?).
See also #19531 and #19551 for other approaches; I opened separate PRs to
simplify comparison of the approaches.
PR Summary
PR Checklist
pytest
passes).flake8
on changed files to check).flake8-docstrings
and runflake8 --docstring-convention=all
).doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).