Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS performance - too many watchers?

I'm trying to debug an AngularJS website to improve performance of the load time. At the moment the browser freezes for 1-2 seconds on the first load with no caching.

From reading various posts I learned that watchers are often the biggest problem for performance in AngularJS apps.

Here is a screenshot from batarang:

batarang results But, how many is too many watchers? 7k~ is a lot, but is that too many?

When debugging in the Chrome console CPU profile, I have a hard time figuring out what calls h - k - z.onload and in general how to improve performance besides having less watchers:

cpu profile results

I know it's a broad question, but I'm looking for any performance tips for AngularJS.

like image 777
Anders Pedersen Avatar asked Apr 21 '16 10:04

Anders Pedersen


1 Answers

Angular start to hit the performence wall when having more then 2000 watchers.

If you have 7K+ watchers in your app, it is due to bad design.

see here https://coderwall.com/p/d_aisq/speeding-up-angularjs-s-digest-loop and here How does data binding work in AngularJS?

like image 52
Kobi Cohen Avatar answered Nov 15 '22 08:11

Kobi Cohen