Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bpo-47189: What's New in 3.11: Faster CPython#32235

Merged
Fidget-Spinner merged 20 commits intopython:mainpython/cpython:mainfrom
Fidget-Spinner:faster_cpython_whatsnewFidget-Spinner/cpython:faster_cpython_whatsnewCopy head branch name to clipboard
Apr 6, 2022
Merged

bpo-47189: What's New in 3.11: Faster CPython#32235
Fidget-Spinner merged 20 commits intopython:mainpython/cpython:mainfrom
Fidget-Spinner:faster_cpython_whatsnewFidget-Spinner/cpython:faster_cpython_whatsnewCopy head branch name to clipboard

Conversation

@Fidget-Spinner
Copy link
Member

@Fidget-Spinner Fidget-Spinner commented Apr 1, 2022

The static objects section's credits go to Kumar Aditya.

TODO:

  • Lazy __dict__ optimizations
  • [ ] dict memory saving optimizations by Inada-san, but I have no clue where to start for those

https://bugs.python.org/issue47189

@bedevere-bot bedevere-bot added the docs Documentation in the Doc dir label Apr 1, 2022
@Fidget-Spinner Fidget-Spinner changed the title What's New in 3.11: Faster CPython bpo-47189: What's New in 3.11: Faster CPython Apr 1, 2022
@Fidget-Spinner
Copy link
Member Author

CC @gvanrossum @markshannon @brandtbucher @iritkatriel @sweeneyde @corona10 @kumaraditya303 @JelleZijlstra. For your opinions and review please (especially on the parts y'all contributed).

Copy link
Member

@corona10 corona10 left a 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.

@markshannon
Copy link
Member

Thank you, It is a great honor to see my name on the list.

You deserve it.

Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Copy link
Member

@markshannon markshannon left a 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.

.. 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.
Copy link
Member

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

Copy link
Member Author

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.

Doc/whatsnew/3.11.rst Show resolved Hide resolved
Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Doc/whatsnew/3.11.rst Show resolved Hide resolved
Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Doc/whatsnew/3.11.rst Show resolved Hide resolved
Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Doc/whatsnew/3.11.rst Show resolved Hide resolved
Fidget-Spinner and others added 2 commits April 3, 2022 14:44
Co-Authored-By: Alex Waygood <Alex.Waygood@Gmail.com>
@Fidget-Spinner
Copy link
Member Author

@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?

@pablogsal
Copy link
Member

@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 :)

Copy link
Member

@gvanrossum gvanrossum left a 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 Show resolved Hide resolved
Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Comment on lines 624 to 625
| | | Calls to certain Python functions are inlined similar | | |
| | | to :ref:`inline-calls`. | | |
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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?

Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Doc/whatsnew/3.11.rst Show resolved Hide resolved
Fidget-Spinner and others added 2 commits April 5, 2022 18:54
Co-Authored-By: Guido van Rossum <gvanrossum@users.noreply.github.com>
Co-Authored-By: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Copy link
Member

@gvanrossum gvanrossum left a 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. :-)

Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Copy link
Member

@gvanrossum gvanrossum left a 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.

Comment on lines 624 to 625
| | | Calls to certain Python functions are inlined similar | | |
| | | to :ref:`inline-calls`. | | |
Copy link
Member

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?

Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Co-Authored-By: Guido van Rossum <gvanrossum@users.noreply.github.com>
@Fidget-Spinner
Copy link
Member Author

Fidget-Spinner commented Apr 6, 2022

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?

Oof the table layout worked against me. The 170% speedup is tied to "Calls to certain python functions are inlined", not C(arg). I have since removed that line altogether.

Copy link
Member

@gvanrossum gvanrossum left a 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.