-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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
gh-89013: Improve the performance of methodcaller (lazy version) #107201
gh-89013: Improve the performance of methodcaller (lazy version) #107201
Conversation
How is methodcaller well used? Often converting to the vectorcall requires maintenance cost, so you need to justify increasing the code complexity. |
@corona10 The PR indeeds adds some additional code (the
But comparing performance and maintenance costs is a bit like comparing apples and oranges, so it it up to you (and other core devs) to make a decision here. |
Modules/_operator.c
Outdated
Py_CLEAR(mc->kwds); | ||
return 0; | ||
_methodcaller_clear_vectorcall(mc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you separate the function?
Please, just inline the function in here if there is no specific reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make it more symmetric with the _methodcaller_initialize_vectorcall
. I will inline here. Let me know if the _methodcaller_initialize_vectorcall
should also be inlined.
Misc/NEWS.d/next/Library/2021-08-16-17-52-26.bpo-44850.r8jx5u.rst
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some minor comments, I will take a look at this PR more.
Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
…endebakpt/cpython into fastmethodcaller_lazy_vectorcall
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Let's see the result of refleak tests.
Leak tests are unrelated to this PR. |
Nice optimization. |
This is a variation on #106960 where the allocation of the structures required for the vectorcall is delayed untill the first invocation of the
methodcaller
. The advantage is that that formethodcaller
objects that are created, but never used, the creation time and amount of memory used is the same as current main.Benchmark results:
Benchmark script