Skip to content

Commit

Permalink
pythongh-129201: Use prefetch in GC mark alive phase. (pythongh-129203)
Browse files Browse the repository at this point in the history
For the free-threaded version of the cyclic GC, restructure the "mark alive" phase to use software prefetch instructions.  This gives a speedup in most cases when the number of objects is large enough.  The prefetching is enabled conditionally based on the number of long-lived objects the GC finds.
  • Loading branch information
nascheme authored Feb 5, 2025
1 parent 5fb019f commit cdcacec
Show file tree
Hide file tree
Showing 2 changed files with 435 additions and 42 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The free-threaded version of the cyclic garbage collector has been optimized to
conditionally use CPU prefetch instructions during the collection. This can
reduce collection times by making it more likely that data is in the CPU cache
when it is needed. The prefetch instructions are enabled if the number of
long-lived objects (objects surviving a full collection) exceeds a threshold.
Loading

0 comments on commit cdcacec

Please sign in to comment.