10000 Trivial bezier cleanups. by anntzer · Pull Request #13300 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Trivial bezier cleanups. #13300

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
Jan 28, 2019
Merged

Trivial bezier cleanups. #13300

merged 1 commit into from
Jan 28, 2019

Conversation

anntzer
Copy link
Contributor
@anntzer anntzer commented Jan 27, 2019

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/api_changes.rst if API changed in a backward-incompatible way

@tacaswell tacaswell added this to the v3.1 milestone Jan 27, 2019
"""Concatenate a list of paths into a single path."""
vertices = np.concatenate([p.vertices for p in paths])
codes = np.concatenate([make_path_regular(p).codes for p in paths])
return Path(vertices, codes)
Copy link
Member

Choose a reason for hiding this comment

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

just out of curiosity, is it really better to do the paths-loop twice?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't done any timings, but I'd bet that the double loop is compensated by the fact that Python knows this is a list comprehension (and can generate the appropriate bytecode) instead of having to lookup what vertices.append and codes.append do at every iteration.

95D8
@jklymak jklymak merged commit 5a53f5e into matplotlib:master Jan 28, 2019
@anntzer anntzer deleted the bezier branch January 28, 2019 09:47
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.

3 participants
0