Skip to content

gh-145685: per-type method cache implementation#150160

Open
kumaraditya303 wants to merge 25 commits into
python:mainfrom
kumaraditya303:mrocache
Open

gh-145685: per-type method cache implementation#150160
kumaraditya303 wants to merge 25 commits into
python:mainfrom
kumaraditya303:mrocache

Conversation

@kumaraditya303

@kumaraditya303 kumaraditya303 commented May 20, 2026

Copy link
Copy Markdown
Contributor

@kumaraditya303 kumaraditya303 added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label May 27, 2026
@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @kumaraditya303 for commit 728021c 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F150160%2Fmerge

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 Test PR w/ buildbots; report in status section label May 27, 2026
Comment thread Python/typecache.c
Comment thread Python/typecache.c
Comment thread Python/typecache.c Outdated
Comment thread Python/typecache.c Outdated
Comment thread Include/internal/pycore_typecache.h Outdated
Comment thread Python/typecache.c Outdated
@JelleZijlstra JelleZijlstra removed their request for review June 3, 2026 12:48
@kumaraditya303 kumaraditya303 requested a review from itamaro as a code owner June 4, 2026 11:07
@kumaraditya303 kumaraditya303 requested a review from colesbury June 4, 2026 18:05
Comment thread Include/internal/pycore_typecache.h Outdated

@colesbury colesbury left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A few more comments below (mostly found by Claude). Also:

  • Have you run single-threaded benchmarks to ensure that we haven't introduced any regressions with this?
  • Does the type_lookup benchmark scale as well as the other scaling benchmarks? In other words, should we consider this a partial or full fix for the type cache scaling issues?

Comment thread Objects/typeobject.c
Comment thread Objects/typeobject.c Outdated
Comment thread Python/typecache.c
new_size = old_size * 2;
}
if (new_size > _Py_TYPECACHE_MAXSIZE) {
// The new size is too big, don't resize and just return.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe we should add a RARE_EVENT_STAT_INC or OBJECT_STAT_INC for this condition?

Comment thread Include/internal/pycore_typecache.h Outdated
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33160644 | 📁 Comparing 4fbec93 against main (8646385)

  🔍 Preview build  

3 files changed
± c-api/type.html
± whatsnew/3.16.html
± whatsnew/changelog.html

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.

4 participants