profile
viewpoint

Ask questionsAngular 12 RC 2 - Compilation is enormously slow and crashes on large build.

🐞 Bug report

Command (mark with an x)

<!-- Can you pin-point the command or commands that are effected by this bug? --> <!-- ✍️edit: -->

  • [ ] new
  • [ x] build
  • [ ] serve
  • [ ] test
  • [ ] e2e
  • [ ] generate
  • [ ] add
  • [ ] update
  • [ ] lint
  • [ ] extract-i18n
  • [ ] run
  • [ ] config
  • [ ] help
  • [ ] version
  • [ ] doc

The build time for for angular 12 RC 2 is very slow - was also slow in RC0. I have quite a big project with multiple lazy loaded modules. If i remove most of these and run its on a base set the compilation takes about 4-5minutes. When i include the lazy loaded modules it aborts after 5 minutes with a JavaScript heap memory.

With small code changes building/sealing takes 2-3 minutes.

[22280:00000215DB856250]  1371502 ms: Scavenge 2017.3 (2061.6) -> 2005.4 (2059.4) MB, 15.0 / 0.0 ms  (average mu = 0.373, current mu = 0.365) allocation failure
[22280:00000215DB856250]  1371545 ms: Scavenge 2020.7 (2061.9) -> 2008.2 (2059.4) MB, 13.9 / 0.0 ms  (average mu = 0.373, current mu = 0.365) allocation failure
[22280:00000215DB856250]  1371582 ms: Scavenge 2023.4 (2061.9) -> 2010.9 (2060.2) MB, 16.2 / 0.0 ms  (average mu = 0.373, current mu = 0.365) allocation failure


<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 00007FF6C293978D]
    1: StubFrame [pc: 00007FF6C29A56B5]
Security context: 0x011ffec408d1 <JSObject>
    2: LimitedMapView$blocklist0 [00000090B0991EF9] [C:\Development\R9-core\business-fed-r12\node_modules\sass\sass.dart.js:19422] [bytecode=000001A84E877181 offset=60](this=0x023f71f290a9 <Object map = 0000003DDD0B6219>,0x023c27a9bae9 <PrefixedMapView0 map = 00000237AEFEDC59>,0x03138c835f49 <UnmodifiableSetView map ...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF6C1D251EF napi_wrap+114271
 2: 00007FF6C1CCFE66 v8::base::CPU::has_sse+66630
 3: 00007FF6C1CD0C66 v8::base::CPU::has_sse+70214
 4: 00007FF6C24E522E v8::Isolate::ReportExternalAllocationLimitReached+94
 5: 00007FF6C24CD301 v8::SharedArrayBuffer::Externalize+833
 6: 00007FF6C239983C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1436
 7: 00007FF6C23A4A70 v8::internal::Heap::ProtectUnprotectedMemoryChunks+1312
 8: 00007FF6C23A1594 v8::internal::Heap::PageFlagsAreConsistent+3204
 9: 00007FF6C2396D93 v8::internal::Heap::CollectGarbage+1283
10: 00007FF6C239D624 v8::internal::Heap::GlobalSizeOfObjects+212
11: 00007FF6C23D344B v8::internal::StackGuard::HandleInterrupts+907
12: 00007FF6C211E459 v8::internal::interpreter::JumpTableTargetOffsets::iterator::operator=+7737
13: 00007FF6C293978D v8::internal::SetupIsolateDelegate::SetupHeap+546637
14: 00007FF6C29A56B5 v8::internal::SetupIsolateDelegate::SetupHeap+988789
15: 00007FF6C28BE73C v8::internal::SetupIsolateDelegate::SetupHeap+42748
16: 000000F5DDB88F1E
angular/angular-cli

Answer questions alan-agius4

@clydin is working on improving the SASS compilation times in general by offloading the compilation to a worker and changing the SASS compilation asynchronous to synchronous. You can see this PR https://github.com/angular/angular-cli/pull/20740.

Dart-sass is synchronous can be twice as fast. From initial testing I did see some good improvements in your project, and the build time did improve by around 15%. The compilation of your application took around 81675ms.

Regarding the OOM issues, I still didn't receive answer for the following questions. I did trigger multiple rebuilds and memory usage did stay consistent;

  • the exact steps / files that you amended to cause the above errors
  • which command are you using?

Should i log a query under @angular/material ?

I think this would be useful, so that it's also tracked in their repo.

useful!
source:https://uonfu.com/
answerer
Alan Agius alan-agius4 Malta Angular Team, Loves TypeScript, Build Tools, Food, Beer & Coffee 🇲🇹
Github User Rank List