由于我们在.Net / Angular Web应用程序中的不利软件架构,我们可能无法为 生产环境 环境执行ng build(--prod)的捆绑 .
我现在的问题是,与使用 ng build --prod
捆绑的相同应用程序相比,装入SystemJS的Angular应用程序的性能提升有多大?
有人进行过性能测量吗?
我尝试使用以下测试应用程序并在Developer Console中读取执行时间但这并不可靠 . angular-realworld-example-app
"SystemJS" | "Bundled Prod"
..... 1.9s ....... | .......... 1.1s
.... 2.2s ....... | .......... 1.4s
..... 1.7s ....... | .......... 1.3s
..... 2.1s ....... | .......... 1.0s
..... 1.8s ....... | .......... 1.1s
..... 1.7s ....... | .......... 1.15s
...~1.68s..... |........~1.17s (平均秒数)
1 回答
ng build --prod创建一个"Ahead Of Time"包(https://angular.io/guide/aot-compiler),这意味着角度编译器不必包含在 生产环境 包中 .
正如文档中所写,在下载大小方面有性能提升:
并且还可以获得应用程序启动时间:
与JIT编译应用程序相比的实际增益取决于模板的数量及其大小 .