> > Is it possible to always perform (unconditionally compile in) the > > necessary housekeeping tasks but stick with the current GC, so that > > cycle-detection only happens when the user calls a > > gc_go_find_cycles() > > function? Would that significantly improve the above numbers? > > Yes, that would be possible, but it wouldn't speed anything up in case > you don't have any cycles.
Not sure I got you right. That is, the speed penalty comes from housekeeping? Does the new GC try to find cycles automatically whenever a refcount goes down to zero? If building and maintaining data structures for the algorithm costs only a little memory but speed impact is neglegible unless the algorithm actually runs, then you could stick with the non-cycle-detecting "legacy" GC (= speed) unless you know you have cycles and/or want to trade a little processing time (a call to gc_go_find_cycles()) for the memory it will/might free. -mp.