Question: Angular 2 AOT vs JIT payload comparison


Angular 2 AOT vs JIT payload comparison

Answers 1
Added at 2016-12-28 11:12

I'm pretty new to Angular 2, so correct me if I'm inaccurate.

My understanding of Angular 1 vs 2 when it comes to compiler:

In Angular 1 the compiler is more general and dynamic, meaning that dirty checking code is a single code running over different components. However for performance sake in Angular 2, every component will get compiled to a generated code that handles bindings and dirty checking for that specific component. It means that depending on the component template, more specifically number of bindings, the generated code becomes larger.

When we use JIT, this is not important as this code doesn't go through the network and is generated in browser. But when using AOT it's going to be transferred from the server.

The problem (possibly):

When the application is small, AOT will definitely result in smaller payload as the compiler is not going to be shipped to browser. But as the application grows, I assume this difference starts to decrease and maybe become inverted (does it?!). But I don't have a quantitative sense of it. Is it going to be a real issue for medium or large scale applications?

Answers to

Angular 2 AOT vs JIT payload comparison

nr: #1 dodano: 2016-12-28 11:12

The solution is to actually manage correctly AOT, with LazyLoading.

To really give an answer, there will be problems, but now we have the tools to manage them. Lazy Loading is a solution that we could not apply to AngularJS easily.

Check out this link, that is really well made and covers the whole subject about modules, contexts, and compilation :

You can also combine both and get the best of it :

Source Show
◀ Wstecz