Posted by Seth Thompson, V8 Track Commentator

In order to ensure a smooth, snappy experience when browsing in Chrome, it’s essential to free unused memory. The garbage collector in the V8 JavaScript engine has been optimized to reclaim memory as quickly as possible to shorten pauses to the main thread of execution. But even small pauses can cause jank when they happen at inopportune moments and block important events like clicks, scrolls, or animation frames. To make garbage collection less noticeable, we’ve integrated Blink’s task scheduler into V8 (starting in M41), so that pauses can be not just short, but intelligently scheduled during moments when the browser is idle. New knowledge of completely inactive pages (such as background tabs), also allows V8 to free larger chunks of memory all at once.  The result is reduced jank when browsing and lower memory usage overall.


Scheduling garbage collection tasks (red) in otherwise idle periods (blue).


Smarter garbage collection makes 3D animations and games play smoothly with reduced lag and stuttering. The new task scheduler integration into V8 provides higher frame-rates more consistently for gameplay and rendering. Between Chrome 41 and Chrome 46, our score for the 3D benchmark OORT Online, which measures smooth rendering of WebGL graphics, increased by up to 33%, just shy of the maximum 10,000 points on a modern desktop.



Memory reduction from the new system is particularly pronounced when the browser is idle for a few minutes or more. Leaving a Gmail tab unused for 2.5 minutes, for example, reduces memory consumption by up to 45% between Chrome 45 and previous versions!

In addition to providing a smoother, faster browsing experience for the user, these changes empower developers to push the limits of Chrome with more powerful applications and better graphics. Stay tuned for more V8 optimizations and check out our deep dive into garbage collection timing on the new V8 blog for more details.