Amir Popovich
Amir Popovich

Reputation: 29836

AngularJS + Single Core CPU = Almost 100% CPU

I've built a large AngularJS application that performed fine on until now.
My problem started when some users(with very old computers that have one CPU) complained about the application being extremely slow.

I've opened the task manager and I can see that the tab is on 70% - 100% CPU always(When using a single core CPU).

Now since this works great on stronger computers, I'm not sure I have a performance issue and if I do, I don't really know how to check this(I can't check this with performance tools on chrome).

Is there any way to handle this? To tell Angular to perform it's digest cycles less times?
Has anyone encountered a similar issue? Any tip will be great for me.

Upvotes: 10

Views: 5710

Answers (1)

Adlen Afane
Adlen Afane

Reputation: 1532

I have never seen ways to reduce the number of times cycles are called.

However there are several ways to improve the performance of your application.

First, to have an idea of the performance from your computer you may install Batarang which provide a tab for performance analysis.

Once you have this you may focus on the following:

  1. Disable the watchers that won't be use anymore
  2. Avoid ng-repeat if possible and/or use the bindonce directive
  3. Use pagination to have smaller sets of data

For more details you may refer to the following articles:

Upvotes: 6

Related Questions