简体   繁体   English

AngularJS表现 - 观众太多了?

[英]AngularJS performance - too many watchers?

I'm trying to debug an AngularJS website to improve performance of the load time. 我正在尝试调试AngularJS网站以提高加载时间的性能。 At the moment the browser freezes for 1-2 seconds on the first load with no caching. 目前浏览器在第一次加载时冻结1-2秒而没有缓存。

From reading various posts I learned that watchers are often the biggest problem for performance in AngularJS apps. 通过阅读各种帖子,我了解到观察者通常是AngularJS应用程序中性能的最大问题。

Here is a screenshot from batarang: 这是batarang的截图:

巴塔朗的结果 But, how many is too many watchers? 但是,有多少观察者? 7k~ is a lot, but is that too many? 7k~很多,但是太多了?

When debugging in the Chrome console CPU profile, I have a hard time figuring out what calls h - k - z.onload and in general how to improve performance besides having less watchers: 在Chrome控制台CPU配置文件中进行调试时,我很难搞清楚什么叫h-k-z.onload,以及除了少观察者之外如何提高性能:

cpu个人资料结果

I know it's a broad question, but I'm looking for any performance tips for AngularJS. 我知道这是一个广泛的问题,但我正在寻找AngularJS的任何性能提示。

Angular start to hit the performence wall when having more then 2000 watchers. 当拥有超过2000名观察者时,角度开始打击性能墙。

If you have 7K+ watchers in your app, it is due to bad design. 如果你的应用程序中有7K +观察者,那是因为设计不好。

see here https://coderwall.com/p/d_aisq/speeding-up-angularjs-s-digest-loop and here How does data binding work in AngularJS? 请看这里https://coderwall.com/p/d_aisq/speeding-up-angularjs-s-digest-loop和这里AngularJS中的数据绑定如何工作?

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

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