As one of the foremost frontend development frameworks, each iteration of Angular is eagerly awaited by developers all around the world. With a host of new features, Angular 9 promises to be one of the biggest releases made by Angular in the past 3 years.
We take a look at its biggest feature, the Ivy compiler, and some of the new major features.
The Ivy Compiler
After being introduced in Angular 8 as an opt-in, the new Ivy compiler and render pipeline is now the default compiler in Angular 9. Ivy promises smaller bundle sizes, better debugging, and a boost in overall performance. Even though Ivy doesn’t affect your workflow in Angular, it does have a major impact on the code being generated.
Let’s take a look.
1. Smaller Apps
You’ll see a considerable boost in performance of your apps.
Ivy is much more efficient than ViewEngine. For each component in Angular less code is generated since the compiler removes the unused parts of Angular. This has a huge impact on the size of the app. The difference in bundle size between Angular 8 apps and Angular 9 apps is almost 40%.
This is a big deal since one of the main drawbacks of Angular when compared to other libraries like React and Vue is the app size. Also, the drop in bundle sizes improves the overall performance of the apps you build.
2. Faster and Efficient Testing
You’ll see a positive impact on your development timeline thanks to Ivy.
With Ivy, you can expect to see a 40-50% boost in test speeds of your apps. This is mainly down to the implementation of TestBed
, which has been completely revamped and is now much more efficient.
How did they do that?
Rather than recompiling all components during each test cycle, the TestBed
in Ivy avoids recompilation between tests unless a component has been manually overridden.
3. More Debugging Tools
Now you have more tools to debug your applications. You have the new ng
object for debugging while running an application in Dev Mode. With this you can now gain access to instances of your components, directives, etc.
4. Improved Handling of Styles and Style Merging
Handling of styles has been greatly improved in Ivy. Usually what happens is that if there were two competing definitions for a style, then those styles would destructively replace each other. Now they are just merged predictably.
In Ivy, bindings do not depend on the timing of changes to these expressions instead, there is a clear, consistent order of precedence with the most specific style having the highest precedence. For example, a binding to [style.color]
overrides a conflicting binding to [style]
.
5. Lazy Loading
In Ivy, any component can be lazy loaded and dynamically rendered. Components can be lazy loaded and rendered without Angular modules or routing. Even the libraries which are only used by a lazy loaded component are bundled into lazy-loaded chunks.
6. AOT Compilation
The AOT Compiler has seen a great deal of improvement because of Ivy’s new architecture. Till Angular 8, JIT compilation was preferred the preferred compiler since AOT was too slow.
Now in Ivy AOT is the default compiler thanks to the huge improvements in build and rebuild times.
Conclusion
With all these features, businesses are ready to move their apps to the recent version. Without doubt, Angular communication offers powerful features, which makes a revolution among the applications.
If you want to know more about how this framework can benefit your business, Book a free consultation now!
Also Read: Vue vs React – The CTOs Guide to Choosing the Right Framework.