-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
bpo-47189: What's New in 3.11: Faster CPython #32235
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-47189: What's New in 3.11: Faster CPython #32235
Conversation
Co-Authored-By: Kumar Aditya <[email protected]>
CC @gvanrossum @markshannon @brandtbucher @iritkatriel @sweeneyde @corona10 @kumaraditya303 @JelleZijlstra. For your opinions and review please (especially on the parts y'all contributed). |
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.
Thank you, It is a great honor to see my name on the list.
You deserve it. |
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.
Thanks for doing this. It is much appreciated.
I've left a few comments.
Doc/whatsnew/3.11.rst
Outdated
@@ -62,6 +62,7 @@ Summary -- Release highlights | |||
.. This section singles out the most important changes in Python 3.11. | |||
Brevity is key. | |||
|
|||
- Python 3.11 is 22% faster than Python 3.10. See `Faster CPython`_ for details. |
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 would rather claim a range, say 10% to 60%.
Once the latest PRs are merged it will be about 25%, if you must have a single number.
https://gist.github.com/markshannon/bf1b99177290db30dd0ab8f56446d0ea
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 will update this number when the benchmark link updates its values/ when those PRs are merged into main
.
Co-Authored-By: Alex Waygood <[email protected]>
@pablogsal are you OK with this going into 3.11 whats new? Or would you prefer I host this somewhere else and link to it in the whatsnew? |
For the time leave it here in its own section as in this way I will be able to easily do the final edits. Removing or moving information is much easier to add it as that way I don't need to consider what may be missing :) |
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 put my nit-picking hat on while reviewing this. :-) Overall great work, and can't wait to see this show up on docs.python.org!
Doc/whatsnew/3.11.rst
Outdated
| | | Calls to certain Python functions are inlined similar | | | | ||
| | | to :ref:`inline-calls`. | | | |
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.
Is this an oblique reference to PRECALL_NO_KW_METHOD_DESCRIPTOR_O
? Or does it refer to something else?
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.
No, it just means that CALL_FUNCTION_EX
for things like f(1, 2, *args, **kwargs)
aren't inlined.
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.
Hm. It's rather subtle what you intend to say then. The text linked under inline-calls
already describes Python-to-Python calls. But they are described here again because specialization adds... what again? It feels like claiming credit for the same optimization in two places. I do realize that there are two separate code changes, but to the readers of a high-level document like this that seems a bit too subtle.
Also, it's not clear for what operation you are claiming a 170% speedup (so a factor 2.7). The table layout makes it look like C(arg)
. But surely the speedup for class constructors is not a single extremely large number?
Co-Authored-By: Guido van Rossum <[email protected]> Co-Authored-By: Irit Katriel <[email protected]>
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.
Bunch of one-character nits. :-)
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.
Honestly this PR is so large and comments are flying so fast we should probably land it ASAP and then iterate.
Doc/whatsnew/3.11.rst
Outdated
| | | Calls to certain Python functions are inlined similar | | | | ||
| | | to :ref:`inline-calls`. | | | |
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.
Hm. It's rather subtle what you intend to say then. The text linked under inline-calls
already describes Python-to-Python calls. But they are described here again because specialization adds... what again? It feels like claiming credit for the same optimization in two places. I do realize that there are two separate code changes, but to the readers of a high-level document like this that seems a bit too subtle.
Also, it's not clear for what operation you are claiming a 170% speedup (so a factor 2.7). The table layout makes it look like C(arg)
. But surely the speedup for class constructors is not a single extremely large number?
Co-Authored-By: Guido van Rossum <[email protected]>
Oof the table layout worked against me. The 170% speedup is tied to "Calls to certain python functions are inlined", not |
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.
Thanks, this looks good now. Thanks very much for all your work on this!
The static objects section's credits go to Kumar Aditya.
TODO:
__dict__
optimizations[ ]dict
memory saving optimizations by Inada-san, but I have no clue where to start for thosehttps://bugs.python.org/issue47189