Optimizing Python Startup Time by Code Data Share
summary
A concrete tool called code data share serializes CPython code objects into a memory-mapped archive, copies constants and variable-length objects, patches type pointers for ASLR, bumps reference counts or uses Python 3.12’s Immortal mechanism, and skips repeated IO and marshal work. Integrated with Alibaba Cloud FC and open sourced, the approach yields about 20–25% startup reduction on 3.11–3.12 for heavy-package workloads like torch by eliminating thousands of file reads; it works but needs per-version upkeep.
AI-written summary · about
