Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
plot_wireframe plotting speedup#29399
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
plot_wireframe plotting speedup#29399
Uh oh!
There was an error while loading.Please reload this page.
Conversation
3b832d3 to8cc938dCompareea4a0dc todfe72edComparedfe72ed to703ef23Compare703ef23 tocb0a07cCompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
ff7a2db to28d03bfCompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
74543da to00062a6Comparescottshambaugh commentedJan 8, 2025
CI failures are unrelated, merging |
d08fd8f intomatplotlib:mainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
PR summary
For large wireframe plots (in my testing, 8000x8000), a large chunk of time is spent doing autoscaling of the axes. There is some opportunity to vectorize these calculations and get speedups.
Changes here:
transforms.update_from_data_xandtransforms.update_from_data_yaxes3d.plot_wireframe. This also stores the data as a numpy array, which gives speedups when drawing.The compiled function
update_path_extentsis actually just about equal with a vectorized numpy approach speedwise when updating both x and y limits. But when doing single axis limits, it needs to check for NaNs for each pair of x or y, so the numpy approach lets you skip the extra x or y calculations and comes out ahead. This bit is a benefit for all 3D functions, not justplot_wireframe. I spent some time trying to refactor the compiled function to operate on just a single axis, but it's tricky to disentangle x and y. The numpy approach was easier and just as fast.For my test case I'm seeing an average over 5 runs on main of 6.82 seconds, and on this PR 4.00 seconds - a 1.7x speedup.
Plotting and drawing on main (avg 6.82 sec):

Plotting and drawing on this PR (avg 4.00 sec):

PR checklist