6

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.

Graham
  • 7,431
  • 18
  • 59
  • 84
Anders Pedersen
  • 2,255
  • 4
  • 25
  • 49
  • 1
    Not sure, how to guess, without looking at code..? 1.5-2k+ watcher will degrade performance for sure, though you could go through [this article](http://bahmutov.calepin.co/improving-angular-web-app-performance-example.html), that might help you. – Pankaj Parkar Apr 21 '16 at 10:43

1 Answers1

7

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?

Community
  • 1
  • 1
Kobi Cohen
  • 678
  • 4
  • 9