简体   繁体   English

摘要周期执行的性能监视器

[英]Performance monitor of digest cycle execution

I have an app, that is very slow on low end PCs, and I just downloaded Batarang to monitor performance. 我有一个应用程序,在低端PC上运行非常慢,我刚刚下载了Batarang来监视性能。

On an empty page, that only has a header and a sidebar, I see this: 在一个只有标题和侧栏的空白页面上,我看到了: 在此处输入图片说明

Meaning, the cycle is constantly running. 意思是,循环不断地在运行。 I don't know why, since I am just watching the page, not clicking a thing, not moving a thing. 我不知道为什么,因为我只是看页面,没有点击物体,没有移动物体。

And in a different AngularJS app (not mine), I see this: 在另一个AngularJS应用程序(不是我的)中,我看到了: 在此处输入图片说明

When not changing a thing, a digest is running every 20-30 seconds. 不进行更改时,摘要每20-30秒运行一次。

Why can a thing like this happen? 为什么会发生这样的事情? Is there a way to check which watchers fired the digest cycle? 有没有办法检查哪些观察者触发了摘要循环?

EDIT: 编辑:

Is there a way to print all dirty watchers, and see what is the expression that is dirty? 有没有办法打印所有脏的观察者,并查看脏的表情是什么?

I printed a random watcher: 我打印了一个随机观察者:

JSON.stringify(getWatchers()[2]) "{"last":3,"eq":false}"

It does not say the expression 它没有说表达

Digest cycle is being run on all triggered changes in scope and on all changes that were caused by previous digest cycle, until there will be no changes detected. 摘要周期将在范围内所有触发的更改以及上一个摘要周期引起的所有更改上运行,直到没有检测到更改为止。

Ex. 例如 There is a click handler in controller where you change some value, than this change might be watched somewhere else, so digest will be run again. 控制器中有一个单击处理程序,您可以在其中更改一些值,而不是在其他地方看到此更改,因此摘要将再次运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM