Book Image

JavaScript at Scale

By : Adam Boduch
Book Image

JavaScript at Scale

By: Adam Boduch

Overview of this book

Table of Contents (17 chapters)
JavaScript at Scale
About the Author
About the Reviewers

Communication overhead

One advantage of directly invoking a method on a component is that there's very little overhead involved. When all inter-component communication is brokered through an event triggering mechanism, there's no way to escape at least a little overhead. In fact, overhead associated with this indirection is hardly noticeable; it's other overhead factors that can cause scalability issues.

In this section we'll look at event triggering frequency, callback execution, and callback complexity. Each of these has the potential to degrade the performance of our software to the point where it is unusable.

Event frequency

When our software has only a handful of components, there's a fundamental limit on the frequency of events. Where event frequency can quickly turn into a problem is when there are lots of components, some of which trigger events in response to events. This means that if the user is doing something quickly and efficiently, or if there are several Ajax responses arriving...