You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On MacOS, where spawing kpsewhich instances is rather slow, this appears
to speed up
```
python -c 'from pylab import *; mpl.use("pdf"); rcParams["text.usetex"] = True; plot(); savefig("/tmp/test.pdf", backend="pdf")'
```
around two-fold (~4s to ~2s). (There's also a small speedup on Linux,
perhaps ~10%, but the whole thing is already reasonably fast.)
Note that this is assuming that the dvi cache has already been built;
the costly subprocess calls here are due to calls to kpsewhich to
resolve the fonts whose name are listed in the dvi file.
Much of the complexity here comes from the need to force unbuffered
stdin/stdout when interacting with kpsewhich (otherwise, things just
hang); this is also the reason why this is not implemented on Windows
(Windows experts are welcome to look into this...; there, the speedup
should be even more significant). (On Linux, another solution, which
does not require a third-party dependency, is to call
`stdbuf -oL kpsewhich ...` and pass bufsize=0 to Popen(), but
`ptyprocess` is pure Python so adding a dependency seems reasonable).
The `format` kwarg to `find_tex_file` had never been used before, and
cannot be handled in the single-process case, so just deprecate it.
0 commit comments