question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Slower compilation when using @ngtools/webpack@7.1.0

See original GitHub issue

Initially 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:closed
  • Created 5 years ago
  • Comments:22 (9 by maintainers)

github_iconTop GitHub Comments

6reactions
clydincommented, Dec 20, 2018

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 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.

If you have concerns about this decision, please let us know.

3reactions
clydincommented, Jan 16, 2019

@psurrey It already has been. Ensure that the project is using both @angular/cli@7.2.1 and @angular-devkit/build-angular@0.12.1.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found