-
-
Notifications
You must be signed in to change notification settings - Fork 8k
cairo: remove the append_path() fast path #13042
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
With the performance improvements in matplotlib#13039 the old slow path is now faster than the previously fast one. And it also works with pycairo. Using the Gtk3Cairo backend with wire3d_animation_sgskip.py: cairocffi + append_fast: 13.27 fps cairo + append_slow: 15.07 fps cairocffi + append_slow: 13.54 fps
bc6bd9b
to
d6ce849
Compare
This should be ready now.
I would like @anntzer to take a look at this before we merge, I suspect this orthogonal to mplcairo, but just want to be sure.
I was thinking that for very long paths (e.g. plot(np.random.rand(10000))
), the "fast" codepath would still be preferable (as it converts the whole Path object to cairo's internal representation in one go, rather than looping on Python's side), but interestingly this is not the case.
I thought what's happening is that:
- for short paths, @lazka's optimizations made python-side iteration fast enough that the previously slow path is good enough,
- for long paths, when rasterizing to the screen or to png, it's the rasterization time itself that starts dominating over the loop-in-python (because the rasterizer must check for all possible self-intersections of the path).
However, the "slow" codepath is actually also faster when writing to a vector format (e.g. pdf), so that can't be the only explanation involved.
In any case, I can repro the reasonable performance (and yes this is totally orthogonal to mplcairo, thanks for the heads up).
Thanks! :)
As seen in matplotlib#13042 it's a bit faster than cairocffi and it also takes 50 ms less time to import here. Also the GTK3Cairo backend requires pycairo, so there is a good chance it's already loaded anyway for that case.
As seen in matplotlib#13042 it's a bit faster than cairocffi and it also takes 50 ms less time to import here. Also the GTK3Cairo backend requires pycairo, so there is a good chance it's already loaded anyway for that case.
As seen in matplotlib#13042 it's a bit faster than cairocffi and it also takes 50 ms less time to import here. Also the GTK3Cairo backend requires pycairo, so there is a good chance it's already loaded anyway for that case.
As seen in matplotlib#13042 it's a bit faster than cairocffi and it also takes 50 ms less time to import here. Also the GTK3Cairo backend requires pycairo, so there is a good chance it's already loaded anyway for that case.
As seen in matplotlib#13042 it's a bit faster than cairocffi and it also takes 50 ms less time to import here. Also the GTK3Cairo backend requires pycairo, so there is a good chance it's already loaded anyway for that case.
Uh oh!
There was an error while loading. Please reload this page.
PR Summary
With the performance improvements in #13039 the old slow path is now faster
than the previously fast one. And it also works with pycairo.
Using the Gtk3Cairo backend with wire3d_animation_sgskip.py:
cairocffi + append_fast: 13.27 fps
cairo + append_slow: 15.07 fps
cairocffi + append_slow: 13.54 fps
PR Checklist