-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-44525: Specialize for calls to type and other builtin classes with 1 argument. #29942
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
bpo-44525: Specialize for calls to type and other builtin classes with 1 argument. #29942
Conversation
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.
The code LGTM. Interested to see the benchmark results.
Benchmark results show a slight speedup, but very close to noise. I think this is worth including because:
|
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.
assert(GET_CACHE()->adaptive.original_oparg == 1); | ||
PyObject *obj = TOP(); | ||
PyObject *callable = SECOND(); | ||
DEOPT_IF(callable != (PyObject *)&PyType_Type, CALL_NO_KW); |
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 don't remember if you like using the Py_IS_TYPE
inline function, but just mentioning it here and leaving it up to you :).
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'll skip on the obfuscation macro 🙂
return -1; | ||
} | ||
if (nargs == 1) { | ||
if (tp == &PyType_Type) { |
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.
Ditto
Increases |
https://bugs.python.org/issue44525