New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to disable sub entry points #1758
Comments
Interesting find. If what you are trying to solve is a performance problem, the approach is not to ignore sub-entry points, because you will run into issues with the dependency graph. You should provide a reproduction repository with generated code where this difference in performance is visible, maybe the overhead of entry points could be reduced. |
Hi @SchnWalter I generated a skeleton library and added 50 modules. yarn && yarn run build // build time ~ 8 seconds
git checkout sub-entries && yarn run build // build time ~47 seconds |
From what I can tell, ng-packagr/src/lib/ngc/ngcc-processor.ts Lines 57 to 65 in 2f470e0
For any change, we'll need to make sure that we don't introduce regressions and we'll need to start adding benchmarks and tests. And we'll need to check with the Angular Core team if the |
@victorsc I looked into a profiler trace for your reproduction and one thing stood out: TypeScript type checking was taking ~35s of a total of ~50s. The reason is that the @SchnWalter ngcc is already somewhat optimized to be smart about whether it needs to run or not, but it still does add some overhead. I'm seeing about 4s being in spent in ngcc in total in the above reproduction, just under 100ms per entry-point. Although that is noticeable, it's also not the end of the world. I think we can do something to reduce the overhead per entry-point to almost nil, though, if ng-packagr would maintain a shared cache of which modules have been processed. I have incorporated the above changes and some more improvements in #1764 which reduces the total time spent for @victorsc's repro from ~50s to just ~12s. Note that the repro does not represent a real-world scenario; as all entry-points are very small. It does show however that the overhead of an entry-point is significantly reduced. |
I briefly talked to @alan-agius4 and he rightfully mentioned that |
I think on future we might consider building all the entry points with a single TS program. The only problem that we need to overcome is rootDirs, which at the moment we set so users don’t accidentally, reference entry-points using relative paths. |
Thanks @JoostK. Nice work! The build time for a basic library[1] is down to ~18% of what I saw with the latest version of the master branch. About ~13s instead of ~72s @victorsc, in my last comment I forgot to mention that in the [1] a generated library that included a basic component and a basic service in each of the 90 sub packages |
The change to enable For projects with a lot of entry-points where the performance penalty is deemed unacceptable it is possible to enable the |
Type of Issue
Description
As a library developer, I would like to have the possibility not to build sub entry points (for dev builds).
Details
We are experiencing build performance issues with our Angular library (30+ sub entries) even after migrating to Angular 10 (related to #1222).
This is why we decided to have 2 separate builds:
index.dev.ts
barrel that exports the sub-entries.In order allow both builds without chaing the code, we created a custom Angular builder that:
package.json
files for each sub-entrypackage.json
file.Expected Behaviour
I would like to have a configuration flag so that ng-packagr ignores sub-entries. This way we can run ng-packagr for the dev build without the pre/post build processing.
Version Information
The text was updated successfully, but these errors were encountered: