We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
RustConf 2023 - A Rust-based garbage collector for Python
Learn how MMTK, a Rust-based garbage collector framework, improved garbage collection performance and reduced management effort for Python in PyPy, with benefits including reduced bugs and easier maintenance.
- Rust-based garbage collector for Python: MMTK is a Rust-based garbage collector framework that is used to develop garbage collectors for multiple languages, including Python.
- Rust is a good choice for implementing garbage collectors due to its safety features and language design.
- The MMTK framework was originally written in Java but was rewritten in Rust due to its benefits.
- MMTK is designed to be language-independent and features a core that is written in Rust, along with language-specific bindings.
- The use of MMTK in PyPy resulted in improved garbage collection performance and reduced management effort.
- The MMTK garbage collector for PyPy features a rewrite of the object model and a new allocation algorithm.
- The transformation phase of the R Python toolchain is where the garbage collection operations are performed.
- The use of MMTK resulted in less bugs and easier maintenance.
- The MMTK bindings for PyPy were written in Rust, but were initially combined with the runtime bindings due to the constraints of the PyPy implementation.
- The MMTK garbage collector for PyPy features a slow path and a fast path for both write barriers and allocations.
- The use of MMTK resulted in a 6-10% reduction in garbage collection time.
- The effort of rewriting the garbage collection policies was considered moderate to high, but was justified by the benefits of using MMTK.
- PyPy’s interpreter is written in R Python, which is compiled to C, but the garbage collector is written in Rust.
- MMTK allows for the separation of concern between the language-specific code and the garbage collector, making it easier to implement and maintain.
- The use of Rust-based garbage collection in PyPy has shown promising results and has the potential to benefit other languages.