Facebook Engineering Blog
Introducing Immortal Objects for Python

Introducing Immortal Objects for Python

8/15/2023 · Eddie Elizondo

What this post added

Introduced Immortal Objects (PEP-683) to Python, allowing objects to bypass reference count and garbage collection checks for true immutability. This reduces private memory usage and increases shared memory by minimizing copy-on-write operations in multi-process Python applications, as demonstrated with Instagram's frontend servers. The implementation involved addressing backward compatibility, platform compatibility, and performance regressions, resulting in a ~2% performance regression. This contribution is a foundational step towards a multi-core Python runtime, supporting proposals like Per-Interpreter GIL (PEP-684) and Optional GIL (PEP-703).

Read the original post ↗