Slower compilation when using @ngtools/webpack@7.1.0
See original GitHub issueInitially reported in https://github.com/angular/angular/issues/26674#issuecomment-443263655 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.
| versions | 1st run | 2nd run | 3rd run | 4th run | 5th run |
|---|---|---|---|---|---|
@angular 7.0.4, @ngtools 7.0.7 |
31s | 15s | 7s | 5s | 5s |
@angular 7.0.4, @ngtools 7.1.0 |
29s | 14.5s | 15.5s | 12s | 12s |
@angular 7.1.1, @ngtools 7.1.0 |
29s | 13.5s | 13.5s | 15s | 16s |
@angular 7.1.1, @ngtools 7.0.7 |
28s | 12.8s | 7s | 5s | 4.2s |
Issue Analytics
- State:
- Created 5 years ago
- Comments:22 (9 by maintainers)
Top Results From Across the Web
Why does C++ compilation take so long? - Stack Overflow
Contrary to popular belief, compiling C++ is not actually all that slow. The STL is slow and most build tools used to compile...
Read more >Generics can make your Go code slower - PlanetScale
There are many reasons for this, but it all boils down to trading longer compile times for significant performance gains in the resulting...
Read more >Why is the compiler so slow? - Arduino Forum
It's currently taking me 5 minutes to compile a sketch (<1K lines) using the Arduino IDE. I'm very new to Arduino but I...
Read more >C++ is too slow to compile, can you share all your tips to lower ...
Put what is using it in its own compilation unit, then you won't have to recompile it multiple times.
Read more >Speeding Up Compilation Time with scalac-profiling
Codebases that make use of libraries like Shapeless, or which rely on typeclass derivation, may be particularly prone to these slow-downs.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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
loadChildrenshould not be affected by the potential of less accurate detection. Note that the function overload ofloadChildrenalso 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.If you have concerns about this decision, please let us know.
@psurrey It already has been. Ensure that the project is using both
@angular/cli@7.2.1and@angular-devkit/build-angular@0.12.1.