[Angular] Increasing performance #36
Aukevanoost
started this conversation in
General
Replies: 2 comments 7 replies
UpdateThe recently released RC10 implements a custom https://github.com/native-federation/angular-adapter/releases/tag/v21.1.11 |
0 replies
|
In comparisson to my test: native-federation/angular-adapter#18 (comment) |
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi everyone!
I've started a discussion to keep track of performance improvements. To keep everything transparent and everyone in the loop. While performance has drastically increased, and is not a problem for small micro frontends. It starts to decrease rapidly on bigger Angular projects. The biggest issue was a lack of cache which has been resolved. Now there are some other solutions that should be researched.
How the builder now works:
The builder currently is a wrapper around the Angular builder and exists of 3 steps:
main.tswith the default Angular builder.This is highly stable but as you might guess, some work is done multiple times. We've fixed a huge chunk by re-enabling the compilation cache but there is more performance to gain:
Improvement 1, Expand sharing the cache
Currently step 2 and 3 have their own cache. Unfortunately, Angular currently doesn't support providing a cache to its default builder. This prevents us from sharing the compilation cache between step 2 and 3. I've already created a PoC and am waiting for a response from the Angular team to implement this option into the Angular builder [1]
Improvement 2, Improving cache invalidation
Right now, the Angular builder decides which files have changed using "watchPack" [2]. This is cool but we don't have access to this watcher in step 2, therefore we don't know which files to invalidate and just to be sure we invalidate all source files [2]. We can also fix this with improvement 1, but in the case that Angular is not merging our PR, we can see if we can run a second watchpack that buffers file changes and releases them when we run subsequent builds of step 2.
Improvement 3, A slim builder
On the surface this feels like a no-brainer, but is more complex then initially appears: Completely removing step 3. The argument could be that step 3 is not helping us that much since we've already compiled the micro frontends. But unfortunately, step 2 is using the Angular compilation plugin which does most of the work but not all, so this means that we're moving a lot of Angular's work like running the vite server, potential edge cases like internationalization and other stuff to our builder, increasing maintenance and fragility on our side.
What we can do is create an experimental slim builder where we remove step 3 and figure out the extra complexity it brings as we go, but it will not be as robust as the builder we have now. Since the 3rd step is the "batteries included" part of our builder that does all the "extra stuff" after the compilation.
Conclusion
There is still a lot to gain in terms of performance, and it's most definitely on our radar, but all improvement steps might take some time to implement.
All reactions