AngularJS Performance Issue with $Digest

AngularJS Performance Issue with $Digest  #angularjs #reactjs

  • The response is used to bind data on view using dir-paginate as below
  • Stack Overflow works best with JavaScript enabled
  • On ng_click , I’m calling a function in its AngularController which is internally calling a function in its AnguarService and this is making a Webservice call and getting a Json object of size 2MB.
  • I’m wondering why $Digest is taking 14 seconds to finish its process.
  • When the control is trying to exit the function in AngularController, below is the call stack and $digest is taking 14 seconds to finish its execution.

On ng_click, I’m calling a function in its AngularController which is internally calling a function in its AnguarService and this is making a Webservice call and getting a Json object of size 2MB. This response is used to bind data on view using dir-paginate as below

@ng_real_ninja: AngularJS Performance Issue with $Digest #angularjs #reactjs

Scenario:

, I’m calling a function in its AngularController which is internally calling a function in its AnguarService and this is making a Webservice call and getting a Json object of size 2MB. This response is used to bind data on view using dir-paginate as below

When the control is trying to exit the function in AngularController, below is the call stack and $digest is taking 14 seconds to finish its execution.

Call Stack:

in above stack is taking 14 seconds. I’m unable to fig out how to optimize it.

My code is pretty simple one.

For Example, function in MyController that i’m referring to above is:

You need to show your code. This problem might be happened because your html binds, some js function called inside a for looping/ng-repeat, or some explicit invoke of the method scope.apply().

Anyway, I had problems like that and I followed this link to solve.

Yes, I’m using dir-paginate to render the data on View with few filters as shown in the original post(edited). I tried removing the filters and it is still the same. – Reddy 3 hours ago

Maybe you can try: 1) Simplify your json object with only necessary data for your screen; 2) Paginate the data on server side and get only the data for the selected page. – Everton Santos 3 hours ago

Yah, this definitely increases performance but it takes lot of time and resources. I’m wondering why $Digest is taking 14 seconds to finish its process. – Reddy 2 hours ago

are you using chrome Timelime tool? This is a good tool to measure and check this issue. – Everton Santos 25 mins ago

If you have a 2MB json text response, you probably are doing something wrong. But, supposing you are doing well…

Splitting is not possible in my scenario. So i’m using pagination. – Reddy 3 hours ago

AngularJS Performance Issue with $Digest