How much faster is Angular bundled with

Due to our unfavorable software architecture in a .Net/Angular web application, we probably can't execute the bundling of ng build (--prod) for the production environment.

My question now is, how big is the performance gain from an Angular application loaded with SystemJS compared to the same application bundled with ng build --prod ?

Has anyone performed a performance measurement?

I tried it with the following test application and read the execution time in the Developer Console but this is not really reliable. 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
(Average seconds)


ng build --prod creates an "Ahead Of Time" bundle ( https://angular.io/guide/aot-compiler ) which means that the angular compiler does not have to be included in the production bundle.

As written in the docs, there's performance gains in terms of download size:

The compiler is roughly half of Angular itself, so omitting it dramatically reduces the application payload.

And also gains in application startup time:

Faster rendering

With AOT, the browser downloads a pre-compiled version of the application. The browser loads executable code so it can render the application immediately, without waiting to compile the app first.

The actual gain compared to a JIT compiled app depends on the amount of templates and their size.

Fewer asynchronous requests

The compiler inlines external HTML templates and CSS style sheets within the application JavaScript, eliminating separate ajax requests for those source files.

链接地址: http://www.djcxy.com/p/14998.html

上一篇: 浮点比较重新审视

下一篇: Angular捆绑了多少速度?