I'm writing a program that contains a generational garbage collector. There are just two generations. What I wonder is: When doing a full collection, do I gain anything (performance-wise) by first collecting the younger objects, promoting the survivors to the old generation, and then collecting the old generation, or should I just garbage collect everything in one sweep? I'm not sure which way people usually do it.
I'm using the two-step method now, since it was a bit simpler to implement, but perhaps a one-step method would be more efficient?
The garbage collector is non-copying, if that matters.