Memory Tiering in Python Virtual Machine
summary
A CPython C-extension called MTP infers per-object hotness by recording reference-count changes in the upper 32 bits of OB_REFCOUNT, performs a stop-the-world marking phase to discover all PyObjects, runs sampling phases and an offline-trained predictor (MLR: R^2 ≈ 0.7, Pearson ≈ 0.84) to estimate object access, aggregates into a software-defined page temperature table, and decides promotions using an eagerness metric combining percent-in-fast-tier, LLC misses, and slow-tier bandwidth. Evaluation across 33 comparisons shows MTP wins 25 vs TDP, 30 vs Alonuma, 15 vs MIS, but pays an initial marking cost and refcount-path CPU overhead.
AI-written summary · about
chapters (9)
- 0:00Memory tiering in Python
- 1:06Python object memory use
- 3:37Limitations of tiering approaches
- 7:32Tracking object hotness
- 12:52Predicting object hotness
- 16:10Hot versus cold pages
- 18:40Configuring MTP
- 23:02MTP summary and benefits
- 24:07Q&A
related talks
23mMemoirs of a Python Object: Memory Management and Improving Performance
28mMemory management in CPython, fast or slow?
25mIs it me or Python memory management? 🤔💻
35mPEP 683: Immortal Objects - A new approach for memory managing
01h 03mA tour of CPython's runtime
29mWhat they don't tell you about building a JIT compiler for CPython
55mMaking CPython Fast Using Trace-based Optimisations
01h 18mPython 103: Mmmm... Understanding Python's Memory Model, Mutability, and Methods
