Skip to content

Commit cdcacec

Browse files
authored
gh-129201: Use prefetch in GC mark alive phase. (gh-129203)
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.
1 parent 5fb019f commit cdcacec

File tree

2 files changed

+435
-42
lines changed

2 files changed

+435
-42
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
The free-threaded version of the cyclic garbage collector has been optimized to
2+
conditionally use CPU prefetch instructions during the collection. This can
3+
reduce collection times by making it more likely that data is in the CPU cache
4+
when it is needed. The prefetch instructions are enabled if the number of
5+
long-lived objects (objects surviving a full collection) exceeds a threshold.

0 commit comments

Comments
 (0)