Faster CPython Announces Plans for Python 3.13: Optimized Interpreter and Memory Management

In fall 2020, CPython core developer Mark Shannon proposed several performance improvements for Python. This proposal is known as the "Shannon Plan" (Shannon Plan). Shannon then created the Faster Cpython project, which he hoped would speed up Python by a factor of 5 through multiple version updates over 4 years.

Microsoft officially joined the program soon after, and the company supported developers including Mark Shannon and Guido van Rossum, working on the "Faster CPython" project.

Recently, Mark Shannon and Michael Droettboom introduced plans for Python 3.13.

They propose three lines of work that can be advanced in parallel:

  • Introducing Tier 2 Optimizer
  • Enable subinterpreters from within Python code ( PEP 554 )
  • Optimize memory management

The goal of the Tier 2 optimizer is to reduce the time spent on the interpreter by at least 50%, and its work plan is roughly as follows:

  • Getting Tier 2 Interpreters to Work
  • generate superblocks
  • Implement basic superblock management functions

As for enabling sub-interpreters from Python code, this work builds on the per -interpreter GIL in Python 3.12 to allow Python programmers to take advantage of better parallelism in sub-interpreters of Python code (without writing C extensions).

There is currently a draft for this work: PEP 554 . Need to update first and push for early approval to change direction if necessary.

Finally, about optimizing memory management. The profiling data shows that memory management and cyclic GC take a considerable amount of time. The current plan is to:

  • Reduce allocations by improving data structures
  • Spend less time doing cyclic GC

further reading

Guess you like

Origin www.oschina.net/news/245576/faster-cpython-for-python-3-13