加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

为什么Angular 2的性能优于Angular 1?

发布时间:2020-12-17 10:23:26 所属栏目:安全 来源:网络整理
导读:精彩的开发人员,我需要一些帮助来澄清为什么Angular 2比Angular 1更具性能? 在搜索网络后,我从Er Shahbaz Sharif in a Quora discussion得出了这个相关的解释: Angular 2 is using Hierarchical Dependency Injection system which is major performance b
精彩的开发人员,我需要一些帮助来澄清为什么Angular 2比Angular 1更具性能?

在搜索网络后,我从Er Shahbaz Sharif in a Quora discussion得出了这个相关的解释:

Angular 2 is using Hierarchical Dependency Injection system which is major performance booster. 
Angular 2 implements unidirectional tree based change detection which again increases performance . 
As per ng-conf meetup,angular 2 is 5 times faster as compared to angular 1

同一讨论中的其他解释似乎也在此围绕.

有人可以为我澄清为什么这两个因素(以及其他因素,如果有的话)有助于提升Angular 2的性能?非常感谢..

Angular2
– 不做深对象比赛.如果在数组中添加/删除项目,则更改检测将不会检测到它.对象属性也是如此,只要它们不直接从视图绑定即可.

>双向绑定分为仅从根到叶的传播检测到的变化.
>从子级到父级的更改仅通过显式事件(输出)传播,仅传递给直接父级.
>当没有输入值发生更改时,ChangeDetectionStrategy.OnPush不会对组件运行更改检测.这修剪了根本不运行变化检测的组件子树.
>代码(尤其是更改检测代码)的编写方式可以由JS VM尽可能地优化.

https://www.quora.com/What-is-the-difference-between-angularjs-and-angular2

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读