测量Angular渲染指令所花费的时间 [英] Measure time taken by Angular to render a directive

查看:67
本文介绍了测量Angular渲染指令所花费的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以衡量Angular渲染指令所花费的时间?

Is there a way I can measure the amount of time it took Angular to render a directive?

或更简单的是,有没有一种方法可以告诉我Angular花了多少时间来检测数据集的变化并呈现新数据集的内容?

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?

例如,假设我有这个:

<div ng-repeat="item in items">
    {{ item.text }} 
</div>

我怎么知道在items中的每个数据集更改与最后一次与DOM相关的操作之间需要多少时间?

How can I know how much time it takes between each dataset-change in items and the last DOM-related operation?

推荐答案

您是否看到过

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>

这篇关于测量Angular渲染指令所花费的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆