Which of JIT or AOT for local dev server to increase developer productivity?

52 views Asked by At

Context

Angular CLI: 14.2.5
Node: 16.18.0
Package Manager: npm 8.19.2 
Angular: 14.2.5
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... pwa, router, service-worker
@angular/flex-layout               14.0.0-beta.40
@angular/material                  14.2.4
@angular/material-moment-adapter   14.2.4
rxjs                               7.5.7
typescript                         4.8.4

We have a quite big monolithic angular app :

  • ~900 components, 21 lazy modules
  • total ts files: 1900
  • material custom theme + sass

We use @angular-devkit/build-angular:dev-server builder for local development

We are struggling with slower and slower ng serve time as the project grows.

So we made a comparison between AOT and JIT compilation mode and it seems JIT outperform by far AOT mode for most topics :

  • bundles size: JIT -> 39Mo, AOT-> 50Mo (AOT added as last column) enter image description here
  • memory footprint: AOT -> requires 5g to not crash on incremental change, JIT -> 3g is enough
  • ng serve and incremental change speed: JIT -> ~120s for ng serve without cache, AOT -> ~160s. JIT is also faster incremental change, except the 1st one made after start

Why is AOT the default compiler for development mode? Are we missing something or is JIT still the best compilation mode for local development?

Any tips to increase dev productivity ? it is quite painful to wait so long when coding :/

Thanks!

0

There are 0 answers