Skip to content

Don't do draw_marker optimization for large paths #3826

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

Merged
merged 5 commits into from
Nov 24, 2014

Conversation

mdboom
Copy link
Member

@mdboom mdboom commented Nov 21, 2014

Really large paths need to be clipped or they will crash the rasterizer.

Fixes #3626, and this is a narrower fix than #3761.

def test_large_single_path_collection():
buff = io.BytesIO()

# Generates a too-large single path in a path collection that
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about doing this with PathCollection([really_long_path])? Personally I think including stackplot in the equation muddies the test (e.g. what if we changed some detail about stackplot in the future).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea. Will update.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@efiring
Copy link
Member

efiring commented Nov 21, 2014

My only question is whether the original optimization is improving real-world performance enough to justify the considerable complexity it introduces.

@WeatherGod
Copy link
Member

I haven't looked to see exactly which optimization this is, but IIRC, it
provides a significant performance difference between scatter() and
plot()-without-lines. Up until two(?) years ago, the going recommendation
for plotting many scatter points was to do plot() with a blank linestyle
because its marker optimization was not available to scatter() (because
scatter can have varying markers). Multiple projects approached me during
SciPy 2011 about the performance issue (particularly networkx) and
switching to plot() solved the issue for them. mplot3d also used to show
significant performance issues when doing scatter() (don't know if it still
does) because redrawing interactively took longer.

On Fri, Nov 21, 2014 at 12:38 PM, Eric Firing notifications@github.com
wrote:

My only question is whether the original optimization is improving
real-world performance enough to justify the considerable complexity it
introduces.


Reply to this email directly or view it on GitHub
#3826 (comment)
.

@mdboom
Copy link
Member Author

mdboom commented Nov 21, 2014

I think this was originally implemented at the request of @ChrisBeaumont of the Glue project. It uses scatter extensively, and was unusably slow without this optimization.

@tacaswell tacaswell added this to the v1.4.3 milestone Nov 21, 2014
@efiring
Copy link
Member

efiring commented Nov 21, 2014

OK, that is awakening some traces in my memory. It makes sense. While you are in the code, @mdboom, would you consider adding a comment, please? Something like "Optimization: use fast marker rendering when possible. This is needed for some uses of scatter, for example."

@cimarronm
Copy link
Contributor

👍 LGTM

mdboom added a commit that referenced this pull request Nov 24, 2014
Don't do draw_marker optimization for large paths
@mdboom mdboom merged commit f686001 into matplotlib:v1.4.x Nov 24, 2014
@mdboom mdboom deleted the path_collection_optimization_crash branch March 3, 2015 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants