M
M
Maxim Ivanov2017-01-04 21:03:27
Angular
Maxim Ivanov, 2017-01-04 21:03:27

Did you feel the difference between AoT and JIT compilation when working with Angular 2?

I put together a simple hello world and didn't notice the difference between AoT and JIT (in a classic Angular 2 build). And I don't know if the game is worth the candle. According to their benchmarks, they are confident that your applications will now fly:
blog.mgechev.com/2016/08/14/ahead-of-time-compilat...
817b13671c0a45d0adf3b0fd5a90416c.jpg
But after I built the application and compared, the difference is 20ms, and it's worth it? And in general, when can you see a significant difference?
JIT (609ms):
e8222459223d47ffa6de5c31862fe276.jpg
AoT (581ms):
31ca2c76da8f450685126fd4a88a2e32.jpg
Sometimes the Timeline shows the result better than before (maybe the browser makes optimizations with several updates):
75d70992e6224cc5ba098598f62f6d22.jpg
As you can see (if you open the image in a new window), the most time is spent on JS interpretation (minimum 460 ms on average in both cases), that is, we optimized rendering using AoT, but the scripts themselves were as bold as they are. And how this optimization is taken care of is no longer clear, everything will depend on the browser engine, since V8 gives an average of 460ms, I'm afraid to imagine what will happen in other browsers (for example, IE10), or is it not necessary to suffer about this?
I understand that AoT collects before webpack assembly (for example) files in which template, style are already statically assembled and now they will not be calculated on the page, but is it scary, I used to use Angular 1 at all, which is now considered wildly outdated ( due to the digest cycle and other rendering brakes)
It's just that if AoT would be so cool, why in the office. The default documentation does not already suggest using this method as a privileged one?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
ozknemoy, 2017-01-12
@splincodewd

Sorry for the offtopic, but I couldn't resist. I don't see the difference between rendering configured Angular 1 and Angular 2 out of the box. the test also shows this https://auth0.com/blog/updated-and-improved-more-b...
and only one optimization was applied in the test

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question