O'Reilly logo

Mastering JavaScript High Performance by Chad R. Adams

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Timers

Here, we are going to learn about optimizing JavaScript timers in detail.

What are timers and how do they affect performance?

Timers are built-in functions of JavaScript that allow the execution of either inline JavaScript code or permit functions to be called at a specific point of time after, or repeatedly during, the life cycle of a JavaScript application.

Timers are a great tool in a JavaScript developer's toolbelt, but they have their own issues when it comes to performance. Consider the fact that the JavaScript language is single-threaded, which means that every line of code in our application cannot be fired at the exact same time as another piece of code in our application. To get around this, we use a built-in function called setTimeout ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required