Issue
In my application, I have noticed that some callbacks are being called excessively during the $digest cycle. This high frequency of calls is causing performance concerns as these callbacks are triggered way more times than expected, sometimes even exceeding 100 calls per UI interaction. I am looking to investigate why this behavior is occurring and find ways to optimize it to prevent any potential performance issues in the future.
Steps Taken
After observing the excessive callback calls, I experimented by simplifying some of the callbacks to just return true instead of evaluating model values. However, this adjustment did not affect the number of $digest calls significantly. Additionally, I tried removing ng-repeat blocks and angular filters across the application, but this also had minimal impact on reducing the number of callback function executions.
It seems that I need a more advanced tool or technique to debug and analyze the $digest loop in my Angular application thoroughly to identify where these excessive calls originate from and how to minimize them effectively.
Queries
What tools and strategies can I utilize to assess the performance of the $digest loop, particularly in terms of the number of loops, within my Angular application?
How can I decrease the frequency of callback calls bound in templates such as the one shown below?
<div ng-if="ctrl.foo()">
<!--<span>content</span> -->
</div>