Skip to content
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-46841: Use *inline* caching for BINARY_OP #31543

Merged
merged 8 commits into from Feb 25, 2022

Conversation

brandtbucher
Copy link
Member

@brandtbucher brandtbucher commented Feb 24, 2022

Here's a sort-of-rough first pass at implementing this idea. BINARY_OP is easy to start with, since it only uses its cache for the adaptive counter member. Initial perf testing doesn't show any impact, which I think is good (it means that the basic idea works well, even when the cache isn't being used).

Related changes:

  • All of the dis utilities grow a show_caches parameter, defaulting to False.
  • wordcode_helpers.h has been moved into compile.c.

https://bugs.python.org/issue46841

Python/ceval.c Outdated Show resolved Hide resolved
Include/internal/pycore_code.h Outdated Show resolved Hide resolved
Python/specialize.c Outdated Show resolved Hide resolved
Python/ceval.c Outdated Show resolved Hide resolved
@@ -24,6 +24,12 @@ interpreter.
Use 2 bytes for each instruction. Previously the number of bytes varied
by instruction.

.. versionchanged:: 3.11
Copy link
Member

@markshannon markshannon Feb 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe don't document this until we are sure it's what we want?

Copy link
Member Author

@brandtbucher brandtbucher Feb 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to keep it, and change it if/when dis changes (which is easy enough). That way we don't forget to document it.

Copy link
Member

@markshannon markshannon Feb 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Once we've started doing this we will need to complete it before the beta release anyway.

@markshannon
Copy link
Member

@markshannon markshannon commented Feb 24, 2022

Looks good in general.
I've commented on https://bugs.python.org/issue46841 about what interface we want to add to the dis module.

@brandtbucher brandtbucher requested a review from markshannon Feb 24, 2022
@brandtbucher brandtbucher added the 🔨 test-with-buildbots label Feb 24, 2022
@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Feb 24, 2022

🤖 New build scheduled with the buildbot fleet by @brandtbucher for commit 1aa079c 🤖

If you want to schedule another build, you need to add the "🔨 test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots label Feb 24, 2022
@markshannon
Copy link
Member

@markshannon markshannon commented Feb 25, 2022

👍
Let the process of inlining the caches commence

@markshannon markshannon merged commit 0f41aac into python:main Feb 25, 2022
86 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants