← 返回首页
bpo-46841: Inline cache for `BINARY_SUBSCR`. by markshannon · Pull Request #31618 · python/cpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

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

Provide feedback

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

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

bpo-46841: Inline cache for BINARY_SUBSCR.#31618

Merged
markshannon merged 11 commits into
python:mainfrom
faster-cpython:inline-cache-binary-subscr
Mar 1, 2022
Merged

bpo-46841: Inline cache for BINARY_SUBSCR.#31618
markshannon merged 11 commits into
python:mainfrom
faster-cpython:inline-cache-binary-subscr

Conversation

markshannon commented Feb 28, 2022
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

brandtbucher left a comment
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Thanks, looks good overall.

I still think that it makes more sense (and is a bit simpler) to just store pointers across four cache entries for now, and explore something like this separately as a possible improvement later. It seems to me that the way you've done it here is quite a bit more complicated, for negligible gain: 6 byte savings per unquickened site, offset by the cost of an extra 2 bytes and a pointer indirection per quickened site, plus 10 more wasted bytes for the vast majority of quickened calls.

But I'll defer to your judgement here.

Comment thread Lib/test/test_capi.py Show resolved Hide resolved
Comment thread Python/specialize.c Outdated Show resolved Hide resolved
Comment thread Python/specialize.c Outdated Show resolved Hide resolved
Comment thread Include/cpython/code.h Outdated Show resolved Hide resolved

Copy link
Copy Markdown
Member Author

I've added some comments on about how to handle pointers to faster-cpython/ideas#263
and removed the need for a per-code-object cache from this PR and shrinks the inline cache a bit.

markshannon merged commit 3b0f1c5 into python:main Mar 1, 2022
brandtbucher mentioned this pull request Mar 2, 2022
26 tasks
markshannon deleted the inline-cache-binary-subscr branch September 26, 2023 12:48
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Footer

© 2026 GitHub, Inc.