问题
Is there a way I can measure the amount of time it took Angular to render a directive?
Or even simpler, is there a way I can tell how much time it took Angular to detect a change in a data set and render the content of the new data set?
For example, let's say I have this:
<div ng-repeat="item in items">
{{ item.text }}
</div>
How can I know how much time it takes between each dataset-change in items
and the last DOM-related operation?
回答1:
Have you seen Angular Batarang? It has many performance testing tools for AngularJS apps. E.g. it can show you the time of the recent digest cycles and the most expensive watchers as well.
Note: I have tested in on this pen with your code and simple button.
<div ng-repeat="item in items">
{{ item.text }}
</div>
来源:https://stackoverflow.com/questions/35345400/measure-time-taken-by-angular-to-render-a-directive