Writing Robust AngularJS Web Applications
There is a caveat: the comparisons need to be simple to fit into 25μs. Unfortunately
it is way too easy to add slow comparison into angular, so it is easy to build slow
apps when you don't know what you are doing. But we hope to have an answer by
providing an instrumentation module, which would show you which are the slow
comparisons.
The boundary conditions set here give us very good hints about practical and
theoretical limits of an application built with AngularJS, as well as set potential
directions for performance tuning.
Luckily for us the "instrumentation module" mentioned by Miško Hevery exists and is
called Batarang, and is available as a Chrome extension in the Chrome Web Store. In
the following screenshot we can see the Batarang extension in action. Among other
useful information Batarang can instrument watches declared on scopes and show:
- Execution time for the individual watches
- Relative time contributed by a given watch expression to the overall
execution time of the entire $digest loop
Batarang allows us to easily pinpoint the slowest watch expressions, and measure
our progress while taking the performance tuning steps.