Scheduling tasks intelligently for optimized performance
Thursday, April 30, 2015
Earlier this month, Chrome began utilizing new techniques to get pages in front of users faster. That's an important piece of the performance story, but it's just one - what about once the page has loaded fully? That's when users want pages to animate smoothly and react quickly to their scrolls and clicks. Chrome 41 included a task scheduler for Chrome's rendering engine that ensures those high-priority tasks are handled immediately, making Chrome feel snappier and run closer to a smooth 60 frames per second.
Given that ambitious goal, Chrome has just milliseconds to produce every frame. But painting graphics to the screen isn't all that Chrome does, and there can be several different tasks contending for a single processor core. Historically Chrome handled execution of tasks, such as animating an image, responding to a click, or doing some memory operations, the same way that a bank handles a queue of customers: the first one line in is the first one handled. While this is simple and straightforward, it's not always the best for optimal performance. An urgent task, such as painting the next frame to the screen, might be added to the end of a long queue of pending tasks. The 60 frames per second goal would be lost.
The latest version of Chrome scrolling a particularly challenging website, with the scheduler enabled (left) and disabled (right).
These changes demonstrate that performance isn't just about doing things faster - it's also about doing things smarter, in the right order, and at the right time. Stay tuned for more updates about how we're using Chrome's scheduler to push the bounds of performance.
Posted by Sami Kyostila and Ross McIlroy, Senior Task Masters