Skip to content

bpo-37231: optimize calls of special methods#13973

Merged
methane merged 2 commits into
python:masterfrom
jdemeyer:bpo37231
Jun 13, 2019
Merged

bpo-37231: optimize calls of special methods#13973
methane merged 2 commits into
python:masterfrom
jdemeyer:bpo37231

Conversation

@jdemeyer

@jdemeyer jdemeyer commented Jun 11, 2019

Copy link
Copy Markdown
Contributor

@mangrisano

Copy link
Copy Markdown
Contributor

/cc @vstinner @methane

@methane methane left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Have you run some microbench?
If there is measurable speedup, please write it in NEWS entry.

@jdemeyer

Copy link
Copy Markdown
Contributor Author

LGTM. Have you run some microbench?

Yes. With this code

class X:
    def __mul__(self, other):
        pass

x = X()

and benchmarking x * x I get a speedup from

Mean +- std dev: 103 ns +- 1 ns

to

Mean +- std dev: 98.6 ns +- 2.2 ns

If there is measurable speedup, please write it in NEWS entry.

Done.

@jdemeyer

Copy link
Copy Markdown
Contributor Author

I'm thinking that this vectorcall_method is useful enough to become official API. But that will be for a different PR.

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.

5 participants