jcrist · GitHub

@jcrist

We used to have a freelist for structs to reduce their allocation costs.
As the CPython interpreter performance has improved, the usefulness of
this has decreased (I now see ~10-15% speedup for allocating in a hot
loop, but this time amounts to ~5-15ns a struct depending on size).
Additionally, recent CPython changes have made supporting a freelist in
this manner tricky. In particular, CPython 3.11 made changes to
deallocation that make it hard (or impossible) to write a freelist that
handles types with GC, weakref, or `__dict__` support.
Since the benefit of the freelist is minimal at this point, and it's now
becoming a maintenance cost, we remove the freelist entirely.

Read the original on github.com ↗