8000 Avoid using Bbox machinery in Path.get_extents; special case polylines. by anntzer · Pull Request #17995 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Avoid using Bbox machinery in Path.get_extents; special case polylines. #17995

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 1 commit into from
Jul 21, 2020

Conversation

anntzer
Copy link
Contributor
@anntzer anntzer commented Jul 21, 2020

update_from_data_xy is much slower than needed; we can use plain numpy
instead. (This speeds up #17974 another ~30-40% on top of #17994.)
For polylines, we can completely skip the bezier handling for even more
speedup. (This fixes the performance regression.)

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/next_api_changes/* if API changed in a backward-incompatible way

@anntzer anntzer changed the title Avoid using Bbox machinery in Path.get_extents. Avoid using Bbox machinery in Path.get_extents; special case polylines. Jul 21, 2020
Copy link
Member
@jklymak jklymak left a comment

Choose a reason for hiding this comment

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

Looks good to me. Any reason bbox.update_from_data_xy is so slow?

@anntzer
Copy link
Contributor Author
anntzer commented Jul 21, 2020

Because it constructs general path objects and then iterates over it using overly general mechanisms, I guess.

update_from_data_xy is much slower than needed; we can use plain numpy
instead.
For polylines, we can completely skip the bezier handling for even more
speedup.
@jklymak jklymak merged commit 80848d2 into matplotlib:master Jul 21, 2020
@anntzer anntzer deleted the bezex branch July 21, 2020 19:36
@QuLogic QuLogic added this to the v3.4.0 milestone Jul 21, 2020
@timhoffm
Copy link
Member

As a performance regression fix, should this be backported to 3.3.1?

@jklymak
Copy link
Member
jklymak commented Jul 21, 2020

I think the regression has been there since 3.0.0, so not urgent, unless there is something more than the tight_bbox PR that added to the slowdown.

@QuLogic
Copy link
Member
QuLogic commented Aug 4, 2020

Further discussion on #17974 says this was introduced in 3.3.0, so maybe we should backport this?

@QuLogic QuLogic modified the milestones: v3.4.0, v3.3.1 Aug 5, 2020
@QuLogic
Copy link
Member
QuLogic commented Aug 5, 2020

@meeseeksdev backport to v3.3.x

meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Aug 5, 2020
QuLogic added a commit that referenced this pull request Aug 5, 2020
…995-on-v3.3.x

Backport PR #17995 on branch v3.3.x (Avoid using Bbox machinery in Path.get_extents; special case polylines.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0