Measure time taken by Angular to render a directive

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 18:22:21

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!