Low-hanging performance improvements#5664
Merged
Merged
Conversation
Instantiating Paths is expensive, but they aren't mutable, so just reuse when possible. WeakValueDictionaries are expensive to construct. We can fix that by handling the weakrefs ourself.
Member
Author
|
I think this is finally ready-to-merge. |
Member
There was a problem hiding this comment.
Does this need a check that v() returns an active ref?
Member
Author
There was a problem hiding this comment.
I currently check on deserializing (__setstate__) where you have to deal with it. No real need to do it in both places unless we really care about the size of the serialization.
tacaswell
added a commit
that referenced
this pull request
Dec 22, 2015
PRF: Low-hanging performance improvements
Member
There was a problem hiding this comment.
FWIW, there is a fast instantiation route for Paths: https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/path.py#L173.
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Instantiating Paths is expensive, but they aren't mutable, so just reuse
when possible.
WeakValueDictionaries are expensive to construct. We can fix that by
handling the weakrefs ourself.
And
cbook.popallhas no reason to exist. Maybe someone's using it and it should stay, but no one should be using it.On my benchmark of:
I get a speedup from 5.04s to 3.81s.