Thursday, April 19, 2018

Advantages/Disadvantages of AOT

Advantages of AOT -
1. Faster download: - The Angular 2 app is already compiled so it is faster.

2. Faster Rendering: - If the app is not AOT compiled and the compilation 
process happens in the browser once the application is fully loaded. This has a wait time for all necessary components to be downloaded and then the time taken by the compiler to compile the app. With AOT compilation, this is optimized.

3. Lesser Http Requests: - It is supporting to the lazy loading. Actually, lazy loading is great concepts for sending HTTP request to the server. It is minimise the multiple requests for each associated html and css, there is a separate request goes to the server.

4. Detect error at build time: - In Angular 2, the compilation happens beforehand and most of the errors can be detected at the compile time and this process providing us a better application’s stability.

5. Ahead-of-time (AOT) compilation delivers faster startup time, particularly when much of the code executes at startup

Disadvantages of AOT -
1. AOT only works only with HTML and CSS and not for other file types. If required other file types that time we will need to follow the previous build step.

2. We need to maintain AOT version of bootstrap file.

3. We need to clean-up step before compiling.

4. It requires more memory and more disk space.

5. JIT compilation must target the least capable of all possible execution platforms.

6. Just-in-time (JIT) compilation profiles the target platform while it runs and re-compiles on the fly to deliver improved performance. JIT generates improved code because it targets the current platform, although it usually takes more time to run than AOT compiled code.

No comments: