@@ -1283,7 +1283,7 @@ gc_list_set_space(PyGC_Head *list, int space)
1283
1283
* K > 2. Higher values of K mean that the old space is
1284
1284
* scanned more rapidly.
1285
1285
*/
1286
- #define SCAN_RATE_DIVISOR 10
1286
+ #define SCAN_RATE_DIVISOR 5
1287
1287
1288
1288
static void
1289
1289
add_stats (GCState * gcstate , int gen , struct gc_collection_stats * stats )
@@ -1566,7 +1566,7 @@ assess_work_to_do(GCState *gcstate)
1566
1566
scale_factor = 2 ;
1567
1567
}
1568
1568
intptr_t new_objects = gcstate -> young .count ;
1569
- intptr_t max_heap_fraction = new_objects * 2 ;
1569
+ intptr_t max_heap_fraction = new_objects * 5 ;
1570
1570
intptr_t heap_fraction = gcstate -> heap_size / SCAN_RATE_DIVISOR / scale_factor ;
1571
1571
if (heap_fraction > max_heap_fraction ) {
1572
1572
heap_fraction = max_heap_fraction ;
@@ -1585,7 +1585,7 @@ gc_collect_increment(PyThreadState *tstate, struct gc_collection_stats *stats)
1585
1585
if (gcstate -> phase == GC_PHASE_MARK ) {
1586
1586
Py_ssize_t objects_marked = mark_at_start (tstate );
1587
1587
GC_STAT_ADD (1 , objects_transitively_reachable , objects_marked );
1588
- gcstate -> work_to_do -= objects_marked ;
1588
+ gcstate -> work_to_do -= objects_marked * 2 ;
1589
1589
validate_spaces (gcstate );
1590
1590
return ;
1591
1591
}
@@ -1597,7 +1597,7 @@ gc_collect_increment(PyThreadState *tstate, struct gc_collection_stats *stats)
1597
1597
}
1598
1598
intptr_t objects_marked = mark_stacks (tstate -> interp , visited , gcstate -> visited_space , false);
1599
1599
GC_STAT_ADD (1 , objects_transitively_reachable , objects_marked );
1600
- gcstate -> work_to_do -= objects_marked ;
1600
+ gcstate -> work_to_do -= objects_marked * 2 ;
1601
1601
gc_list_set_space (& gcstate -> young .head , gcstate -> visited_space );
1602
1602
PyGC_Head increment ;
1603
1603
gc_list_init (& increment );
@@ -1608,7 +1608,7 @@ gc_collect_increment(PyThreadState *tstate, struct gc_collection_stats *stats)
1608
1608
Py_ssize_t increment_size = move_all_transitively_reachable (& working , & increment , gcstate -> visited_space );
1609
1609
gc_list_validate_space (& increment , gcstate -> visited_space );
1610
1610
assert (working .top == NULL );
1611
- while (increment_size < gcstate -> work_to_do * 2 ) {
1611
+ while (increment_size < gcstate -> work_to_do ) {
1612
1612
if (gc_list_is_empty (not_visited )) {
1613
1613
break ;
1614
1614
}
@@ -1628,7 +1628,7 @@ gc_collect_increment(PyThreadState *tstate, struct gc_collection_stats *stats)
1628
1628
gc_collect_region (tstate , & increment , & survivors , stats );
1629
1629
gc_list_merge (& survivors , visited );
1630
1630
assert (gc_list_is_empty (& increment ));
1631
- gcstate -> work_to_do -= increment_size / 2 ;
1631
+ gcstate -> work_to_do -= increment_size ;
1632
1632
1633
1633
add_stats (gcstate , 1 , stats );
1634
1634
if (gc_list_is_empty (not_visited )) {
0 commit comments