3 ms·
Yes. Firefox had terrible GC pauses until last year [1]. Chrome processes just a portion of the heap at a time to reduce pauses to a minimum [2]. You can minim
by ricardobeat 14y ago
Yes. Firefox had terrible GC pauses until last year [1]. Chrome processes just a portion of the heap at a time to reduce pauses to a minimum [2].
You can minimize GC by being clever about re-using objects, avoiding waste. The top answer shows how GC happens less frequently when using a setTimeout loop instead of setInterval, I don't know the underlying reason but that was always recommended before requestAnimationFrame came along.
These days you should use requestAnimationFrame whenever available - it allows the browser to plan ahead for a smoother framerate, adjust rate to the device capabilities, and save resources when it's in the background.
[1] http://phoboslab.org/log/2011/08/are-we-fast-yet http://phoboslab.org/log/2011/08/are-we-fast-yet
[2] https://developers.google.com/v8/design#garb_coll https://developers.google.com/v8/design#garb_coll