bpo-44525: Specialize for calls to type and other builtin classes with 1 argument.#29942
Merged
markshannon merged 5 commits intopython:mainpython/cpython:mainfrom Dec 15, 2021
faster-cpython:specialize-calls-to-builtin-typesfaster-cpython/cpython:specialize-calls-to-builtin-typesCopy head branch name to clipboard
Merged
bpo-44525: Specialize for calls to type and other builtin classes with 1 argument.#29942markshannon merged 5 commits intopython:mainpython/cpython:mainfrom faster-cpython:specialize-calls-to-builtin-typesfaster-cpython/cpython:specialize-calls-to-builtin-typesCopy head branch name to clipboard
markshannon merged 5 commits intopython:mainpython/cpython:mainfrom
faster-cpython:specialize-calls-to-builtin-typesfaster-cpython/cpython:specialize-calls-to-builtin-typesCopy head branch name to clipboard
Conversation
Member
Fidget-Spinner
left a comment
There was a problem hiding this comment.
The code LGTM. Interested to see the benchmark results.
Member
Author
|
Benchmark results show a slight speedup, but very close to noise. I think this is worth including because:
|
Fidget-Spinner
approved these changes
Dec 15, 2021
| assert(GET_CACHE()->adaptive.original_oparg == 1); | ||
| PyObject *obj = TOP(); | ||
| PyObject *callable = SECOND(); | ||
| DEOPT_IF(callable != (PyObject *)&PyType_Type, CALL_NO_KW); |
Member
There was a problem hiding this comment.
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 :).
Member
Author
There was a problem hiding this comment.
I'll skip on the obfuscation macro 🙂
| return -1; | ||
| } | ||
| if (nargs == 1) { | ||
| if (tp == &PyType_Type) { |
Member
Author
|
Increases |
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.
https://bugs.python.org/issue44525