-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Slower compilation when using @ngtools/[email protected] #13102
Comments
Seems like diagnostics runs even though that should run in a seperate process? |
I guess #12824 caused this? I'm not sure if this is the intended behavior. An opt-out would be nice. |
Hi, How can i downgrade @ngTools to 7.0.7? Thanks |
‘npm i @ngtools/[email protected]‘ |
I tested this regression using https://github.com/angular/angular/tree/master/aio, rebuilding without AOT and any optimizations, and got these results:
So I think #13133 addressed part of the problem, but there's still a regression caused by #12824. I looked at the changes and think it's because, on JIT, syntactic diagnostics are now always gathered for the whole program. Before they were only gathered for the whole program on the first run or when the type checker was off. But we have a code path for when less than 20 files changes that only emits those files: angular-cli/packages/ngtools/webpack/src/angular_compiler_plugin.ts Lines 1084 to 1108 in 603e6f4
In that case, we should only check diagnostics for the files we are emitting. That should reduce the rebuild time. |
Was working a bit on this today and noticed that the results I took yesterday were of rebuilds without a vendor chunk, which great inflate total rebuild times. To get more granular information I also used an internal profiling flag we have to see where time is spent in compilations. The results I got were:
A few notes about these profiling messages:
My previous guess was that syntactic diagnostics on rebuilds were still taking too long, but that doesn't really hold true since in What does seem to take a lot longer is That increase seems related to #12418, where the way we process lazy routes and their errors changed. |
Hello @filipesilva is there any news? |
I can confirm. The rebuild is slower with With
And with
|
The issue is indeed that within 7.1.x the Angular compiler is always used to calculate the set of lazy routes when in JIT mode. This was initially done to guarantee that the lazy routes were calculated accurately and any lazy route related errors would be shown upon a rebuild. This has the unfortunate downside of taking more time. The underlying problem is one of correctness/accuracy versus speed. The team has decided to bring back the faster but potentially less accurate method of detecting lazy routes upon JIT rebuilds (first builds will always use the more complete Angular compiler method). Applications that do not have lazy routes within libraries and that only use direct string literals with If you have concerns about this decision, please let us know. |
When can we fix this problem?I'm looking forward to resolve it. Thanks! |
@filipesilva In my case, run
Once I upgrade @angular/cli to 7.1.4 , it takes 88 seconds. my repo is https://github.com/worktile/ngx-tethys, you can reproduce use |
@why520crazy, I'll be working on this today. |
@why520crazy this issue is regarding rebuild performance in JIT mode and will have no effect on initial builds or production (AOT) builds. Your issue is more likely due to this terser (the JavaScript minifier) issue: terser/terser#204 |
@clydin I see, thanks. |
I had the same issue and forcing a higher version of terser fixed my build.
|
This reverts commit edb84b3 The team has decided to bring back the faster but potentially less accurate method of detecting lazy routes upon JIT rebuilds (first builds will always use the more complete Angular compiler method). Applications that do not have lazy routes within libraries and that only use direct string literals with loadChildren should not be affected by the potential of less accurate detection. Note that the function overload of loadChildren also does not apply to this situation. For those projects where correctness of lazy route detection outweighs rebuild speed, please consider using AOT mode for development. AOT mode will also provide a full set of template errors as well which JIT mode is not capable of doing. Fixes #13102
This reverts commit edb84b3 The team has decided to bring back the faster but potentially less accurate method of detecting lazy routes upon JIT rebuilds (first builds will always use the more complete Angular compiler method). Applications that do not have lazy routes within libraries and that only use direct string literals with loadChildren should not be affected by the potential of less accurate detection. Note that the function overload of loadChildren also does not apply to this situation. For those projects where correctness of lazy route detection outweighs rebuild speed, please consider using AOT mode for development. AOT mode will also provide a full set of template errors as well which JIT mode is not capable of doing. Fixes #13102
I'm using
|
I see that this has been fixed by a revert. Any plans when this is going to be released? |
@psurrey It already has been. Ensure that the project is using both |
@clydin thanks for pointing out that |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This reverts commit edb84b3 The team has decided to bring back the faster but potentially less accurate method of detecting lazy routes upon JIT rebuilds (first builds will always use the more complete Angular compiler method). Applications that do not have lazy routes within libraries and that only use direct string literals with loadChildren should not be affected by the potential of less accurate detection. Note that the function overload of loadChildren also does not apply to this situation. For those projects where correctness of lazy route detection outweighs rebuild speed, please consider using AOT mode for development. AOT mode will also provide a full set of template errors as well which JIT mode is not capable of doing. Fixes angular#13102
Initially reported in angular/angular#26674 (comment) by @sod
hm indeed, just updating ngtools gives me the slowdown. Also using angular 7.1 with old ngtools 7.0.7 is significantly faster.
@angular 7.0.4, @ngtools 7.0.7
@angular 7.0.4, @ngtools 7.1.0
@angular 7.1.1, @ngtools 7.1.0
@angular 7.1.1, @ngtools 7.0.7
The text was updated successfully, but these errors were encountered: