Repository navigation
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Merging this PR will degrade performance by 11.74%
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
f2b1f39 to
0d1e846
Compare
0d1e846 to
1480f43
Compare
Assisted-by: Codex:gpt-5.6-sol
1480f43 to
53e2bb2
Compare
Assisted-by: Codex:gpt-5.6-sol
53e2bb2 to
293a7e8
Compare
Summary
Type mutation previously invalidated method-cache entries by scanning all 4,096 slots for the type's old version tag. This made every cached type mutation pay for a full-cache scan.
This change invalidates the type by setting its version tag to zero and leaves the old cache entry in place. Type version tags are monotonic and never reused; once the counter is exhausted, new tag assignment remains disabled. Cache readers accept an entry only when its version and interned name match the type's current version under the existing sequence-lock protocol, so an entry for an invalidated version is unreachable.
Cached values are already marked as published and use QSBR-delayed allocation reclamation, which lets an in-flight reader that observed the old version finish its conditional incref safely. The existing whole-cache clear still nulls every borrowed pointer before cyclic GC breaks type reference cycles.
This also adds a microbenchmark for repeated cached lookup followed by type mutation, plus focused tests for version reachability and concurrent cache readers.
Performance
benches/microbenchmarks/type_cache_invalidation.pycompares the benchmark-only commit (16413a9) with the invalidation change (53e2bb2). Re-measured on 2026-10-25 after rebasing ontomain(0f74d1c): Apple M1 Max, rustc 1.99.0,cargo bench --bench microbenchmarks(criterion mean of 100 samples), mutation counts as in the harness:AI assistance
Codex (
gpt-5.6-sol) assisted extensively with the implementation, tests, benchmark setup and analysis, automated validation, code review, and drafting this PR description.