PEP 703's BRC: Avoiding Past Performance Traps

PEP 703 introduces Biased Reference Counting (BRC) as a key innovation to mitigate the single-thread performance issues that doomed prior GIL removal efforts, aiming for near-zero impact on existing Python code.

The top 3

  1. Biased Ref-Counting: Single-Thread Speed Secret: PEP 703's Biased Reference Counting (BRC) prevents significant single-thread slowdowns by using cheaper, non-atomic reference count updates for objects primarily accessed by their 'owning' thread, while reserving atomic operations for shared access.
  2. Beyond BRC: Immortal Objects & Deferred Counts: In addition to BRC, PEP 703 leverages 'immortalization' for core, long-lived objects like `None` to entirely bypass reference counting, and 'deferred reference counting' for high-contention objects, further reducing overhead and avoiding performance traps.
  3. Halving Single-Thread Performance Penalty: Previous GIL removal attempts faced ~20% single-thread slowdowns, but PEP 703 initially aimed for a 10-15% penalty. With Python 3.14 improvements, this overhead has been reduced to roughly 5-10%, making the optional GIL a more practical choice.

Sources

Open the full topic