Uh oh!
There was an error while loading. Please reload this page.
gh-145685: per-type method cache implementation - #150160
Conversation
bedevere-bot
commented
May 27, 2026
🤖 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. |
Uh oh!
There was an error while loading. Please reload this page.
colesbury
left a comment
There was a problem hiding this comment.
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_lookupbenchmark 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?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Documentation build overview
155 files changed · |
Uh oh!
There was an error while loading. Please reload this page.
kumaraditya303
commented
Jun 25, 2026
Benchmark results show that it is 1% slower on gil enabled build https://github.com/facebookexperimental/free-threading-benchmarking/blob/main/results/bm-20260616-3.16.0a0-4fbec93/bm-20260616-vultr-x86_64-kumaraditya303-mrocache-3.16.0a0-4fbec93-vs-base.md I think it it is within the error of benchmark machines and not significant. |
markshannon
commented
Jun 25, 2026
I'm very wary of dismissing 1% slower as "within the noise" without some other evidence that there is no slowdown for a change like this. It also looks like you've missed several of the stats. How does this change memory use? |
colesbury
commented
Jun 25, 2026
Results from running locally on my machine (via Claude, GIL-enabled, clang-20, optimized, lto=thin) look good: https://gist.github.com/colesbury/1e5c1eb4ccc1e626696b568d18d8bbc4. Cache misses drop substantially, but the overall effect is small (possibly within the noise margin) because:
A few more suggestions:
|
kumaraditya303
commented
Jun 26, 2026
I've added stats for resizes and invalidations and removed collisions. |
# Conflicts: # Lib/test/test_free_threading/test_type.py
@markshannon Do you have more comments/concerns on this? |
dpdani
commented
Jul 16, 2026
I would still like to see the top comment "Lock-free per type method cache implementation" rephrased since it's not a lock free implementation. |
kumaraditya303
commented
Jul 17, 2026
How would you rephrase it, do you have a suggestion? |
dpdani
commented
Jul 17, 2026
How about just "Per-type method cache implementation"? |
_PyType_Lookup/_PyType_LookupStackRefAndVersion#145685