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
SVG savefig + LaTeX extremely slow on macOS #9653
Comments
Do you have a minimal example of code that when run causes the slowdown? |
I have created two extremely simple examples, one without LaTeX and one with LaTeX (see below). The result: $ time python3 without_latex.py
python3 without_latex.py 0.47s user 0.08s system 96% cpu 0.568 total
$ time python3 with_latex.py
python3 with_latex.py 6.40s user 0.62s system 96% cpu 7.251 total The use of LaTeX makes saving the figure ~13x slower. Rendening is a bit more tricky to time. What I have done is simply suppressed the saving (i.e. nothing is shown neither). The result: $ time python3 without_latex.py
python3 without_latex.py 0.39s user 0.07s system 96% cpu 0.479 total
$ time python3 with_latex.py
python3 with_latex.py 0.38s user 0.07s system 96% cpu 0.470 total The scripts:
|
@jklymak Can you please verify the current description, and possibly lift the "needs clarification" label? |
I get about 3x slower. Not sure what the issue is. It is a bit slower to |
Using Do you see the slow down with other files types (png, pdf) or just svg? |
With Master on a mac. The cache directory is not being written to on my machine. eps, png, pdf take about 2.8s. w/ usetex False they all take about 1s. I assume that the cache is not being written, and maybe svg is calling the subprocess twice for some reason. ping @anntzer because I know he has/had a PR in to homogenize the backends. Maybe that PR fixes the extra calls. Not sure about the caching issue. |
OK. There appears to be a permissions issue on macOSX - the cache should be at New timing is 5.2s for the second call to writing an svg. 1.8s for a pdf. So the cache saves 2s for the svg, 1s for the PDF. So, two problems:
EDIT: Maybe an old version setup the |
A quick look at the backend code: It looks like svg draws tex characters as paths. It seems like the PDF gets the font info and places the characters. Obviously drawing the paths will be a lot slower than just placing the characters. Someone would have to spend some time on this I think. |
You can do |
Possible duplicate: #4880 |
(sorry, clicked close instead of cancel) |
I think this will be closed by #19558 (or one of its variants), which appears to make svg+usetex essentially as fast as pdf+usetex (and much faster than either previous +usetex versions). |
Mostly closed by #19538 and #19558. At least another possibility remaining for speeding up usetex is discussed at #4880 (comment), but that can be tracked by #4880. |
When I saving a SVG figure is slowed down significantly (10-100x) when I use LaTeX, enabled by the following rc-setting:
Note that rendering is somewhat slower, but not much. It is really the saving. I am on macOS 10.12.6 with matplotlib (2.1.0).
The text was updated successfully, but these errors were encountered: