Sunday, 9 November 2014

Browser and the Event Loop

This is an extension of my last post and I wrote it after watching Philip Robert's speech.

A browser is constrained by what you are doing with the Javascript. The browser would like to repaint /render the screen 60 frames per millisec, but it can't render if there is code in the call stack. The render is like a callback with the difference that it gets a priority among callbacks. That is, if the stack is empty and there the render is in queue, it will be executed despite the fact that any other callback is before it.

While render is blocked, you cannot select text on screen, click on a button and see the response etc. That is why we should not put slow code on the stack . We should not block the event loop.

No comments:

Post a Comment