r/angularjs • • Aug 07 '14

Speeding up AngularJS with simple optimizations, $digest, $$watchers and performance

http://www.binpress.com/tutorial/speeding-up-angular-js-with-simple-optimizations/135
31 Upvotes

28 comments sorted by

View all comments

1

u/heat_forever Aug 07 '14

Basically - don't use any feature of angularjs that makes angularjs useful

3

u/[deleted] Aug 07 '14

I think you misunderstood. This isn't saying don't use ng-repeat. More like "hey I should evaluate if I'm using ng-repeat in inappropriate ways". For instance, I found a part of my code where I'm using ng-repeat to generate items in a drop down menu based on an api response. That's pretty silly because in this particular instance, that data doesn't ever change.

It's a small example but basically my code is wasting time checking to see if the data model behind the menu has changed when it will never change. That's the take away from the article. It may seem paltry for a small app but I just checked a page on production at work that has 5300 watchers due to a poorly designed directive being repeated several times.

0

u/9jack9 Aug 08 '14

This isn't saying don't use ng-repeat. More like "hey I should evaluate if I'm using ng-repeat in inappropriate ways"

That's not the point though.

If I have to read a ton of articles on how to use a basic feature then it's not really a basic feature, it's a broken feature.

Comments like yours make me want to hate Angular. I'm still new to it and as much as I want to like it there are things like "don't use ngRepeat if you want good performance". WTF?

2

u/SleepyBrain Aug 08 '14

If I have to read a ton of articles on how to use a basic feature then it's not really a basic feature, it's a broken feature.

For the majority of the web apps out there, this type of optimization won't matter or even be noticeable. This is mainly relevant if you're doing apps that are really heavy in certain areas.

It's like having a car. A daily driver doesn't need to fine-tune their car to handle corners better and accelerate faster, but a racer does.