Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Low-hanging performance improvements#5664

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

Merged
tacaswell merged 7 commits intomatplotlib:masterfrommdboom:performance
Dec 22, 2015

Conversation

mdboom
Copy link
Member

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.

Andcbook.popall has no reason to exist. Maybe someone's using it and it should stay, but no oneshould be using it.

On my benchmark of:

plt.subplots(8, 8)plt.savefig("test.png")

I get a speedup from 5.04s to 3.81s.

Instantiating Paths is expensive, but they aren't mutable, so just reusewhen possible.WeakValueDictionaries are expensive to construct.  We can fix that byhandling the weakrefs ourself.
@mdboom
Copy link
MemberAuthor

I think this is finally ready-to-merge.

# turn the weakkey dictionary into a normal dictionary
d['_parents'] = dict(six.iteritems(self._parents))
# turn the dictionary with weak values into a normal dictionary
d['_parents'] = dict((k, v()) for (k, v) in
Copy link
Member

Choose a reason for hiding this comment

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

Does this need a check thatv() returns an active ref?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I currently check on deserializing (__setstate__) where youhave to deal with it. No real need to do it in both places unless wereally care about the size of the serialization.

Copy link
Member

Choose a reason for hiding this comment

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

fair enough.

@tacaswelltacaswell added this to theproposed next point release (2.1) milestoneDec 22, 2015
tacaswell added a commit that referenced this pull requestDec 22, 2015
PRF: Low-hanging performance improvements
@tacaswelltacaswell merged commit50ce5ff intomatplotlib:masterDec 22, 2015
@@ -93,6 +93,8 @@
(TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN,
CARETLEFT, CARETRIGHT, CARETUP, CARETDOWN) = list(xrange(8))

_empty_path = Path(np.empty((0, 2)))
Copy link
Member

Choose a reason for hiding this comment

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

@QuLogicQuLogic mentioned this pull requestAug 29, 2018
6 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v2.1
Development

Successfully merging this pull request may close these issues.

3 participants
@mdboom@tacaswell@pelson

[8]ページ先頭

©2009-2025 Movatter.jp