Skip to content

Angular 18.1.2 (core/cli) build 4 to 6 times slower then Angular 17.3.12 (core)/17.3.8(cli) #57287

Closed

Description

@jcompagner

Command

build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

17.3.8

Description

when we moved our product from angular 17.3.x to angular 18.1.x the build time increased a lot (its kind of what i guess it was before the nice new application builder)

17: Application bundle generation complete. [10.941 seconds]

18: Application bundle generation complete. [67.430 seconds]

also the cpu seems to spike a lot, and also memory useage seems to go through the roof. (maybe that last part is the problem)

it checked what the update from 17->18 really did, but there are not really any changes in the angular.json or tsconfig files.
The only thing that really changed in angular.json was the move for @nagular/localize/init (to the polyfills array)

Servoy/servoy-eclipse@168148f

Minimal Reproduction

i have created 2 dumps of pretty much the same code:
17.zip: https://drive.google.com/file/d/101jGhs4Ujdrb59MbA45CM8X9RHYOoVMh/view?usp=sharing
18.zip: https://drive.google.com/file/d/1PrykSeOWgokdfe29ta0wlkxCRIMSBr-Z/view?usp=sharing

if those are unzipped into there own dirs
then in the root dir "npm install" in the sub "Test" dir "npm install"
then run "npm run build_lib_debug_nowatch" once in the Test sub dir

and then you can run "npm run build_debug_nowatch"
then for me on my local system the one from 17 is around 11 seconds and the one from 18 is around 48 seconds

I did track it down because of the 2 extra packages we install, those are in the packages@servoy directory
it really seems to be related to that, adding more of this (and especially those 2) seems to add a lot of time.

Exception or Error

around the same build time as 17 .

Your Environment

Angular CLI: 18.1.2
Node: 20.16.0
Package Manager: npm 10.8.1
OS: win32 x64

Angular: 18.1.2
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1801.2
@angular-devkit/build-angular   18.1.2
@angular-devkit/core            18.1.2 (cli-only)
@angular-devkit/schematics      18.1.2 (cli-only)
@schematics/angular             18.1.2
ng-packagr                      18.1.0
rxjs                            7.8.1
typescript                      5.5.4
zone.js                         0.14.8

Anything else relevant?

No response

Activity

  1. alan-agius4 commented on Aug 7, 2024

    @alan-agius4
    Contributor

    I've investigated the issue and found that the regression is related to the ngc compiler. I also tested tsc directly to determine if this was a TypeScript regression, but it doesn't seem to be the case.

    Version 17

    $ time npx ngc -p src/tsconfig.app.json 
    npx ngc -p src/tsconfig.app.json  33.65s user 1.89s system 198% cpu 17.892 total
    
    $ time npx tsc -p src/tsconfig.app.json
    npx tsc -p src/tsconfig.app.json  19.98s user 1.19s system 202% cpu 10.469 total

    Version 18

    $ time npx ngc -p src/tsconfig.app.json 
    npx ngc -p src/tsconfig.app.json  117.00s user 2.18s system 119% cpu 1:39.41 total
    
    $ time npx tsc -p src/tsconfig.app.json
    npx tsc -p src/tsconfig.app.json  20.82s user 1.33s system 205% cpu 10.757 total
  2. added
    area: performance
    regression
    area: compiler
    on Aug 7, 2024
  3. modified the milestone: needsTriage on Aug 7, 2024
  4. alan-agius4 commented on Aug 7, 2024

    @alan-agius4
    Contributor

    Note: To successfully run the reproductions, I had to adjust the tsconfig.json path mappings to the following configuration:

    "paths": {
      "@servoy/dialogs": ["../projects/dialogs/src/public-api.ts"],
      "@servoy/ngclientutils": ["../projects/ngclientutils/src/public-api.ts"],
      "@servoy/window": ["../projects/window/src/public-api.ts"],
      "@servoy/servoydefault": ["../projects/servoydefault/src/public-api.ts"]
    }
  5. jcompagner commented on Aug 7, 2024

    @jcompagner
    Author

    Note: To successfully run the reproductions, I had to adjust the tsconfig.json path mappings to the following configuration:

    "paths": {
      "@servoy/dialogs": ["../projects/dialogs/src/public-api.ts"],
      "@servoy/ngclientutils": ["../projects/ngclientutils/src/public-api.ts"],
      "@servoy/window": ["../projects/window/src/public-api.ts"],
      "@servoy/servoydefault": ["../projects/servoydefault/src/public-api.ts"]
    }

    i updated the 2 zips with those paths.

  6. added a commit that references this issue on Aug 7, 2024
    bae54a1
  7. added a commit that references this issue on Aug 7, 2024
    0b1dd39
  8. added a commit that references this issue on Aug 7, 2024
  9. jcompagner commented on Aug 7, 2024

    @jcompagner
    Author

    thx for the fix, this is way better:

    Application bundle generation complete. [13.731 seconds]

    i do wonder why we (i couldn't find anybody else complaining about this) hit this problem so easy (and so visible/noticable) or was it only sneaked in in a 18.1.1 or .2 release?

  10. JeanMeche commented on Aug 8, 2024

    @JeanMeche
    Member

    The change landed in a 18.1 pre-release but you're the first one to report it (which kind of suprised us, as you said the perf impact was quite important)

  11. angular-automatic-lock-bot commented on Sep 8, 2024

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  12. locked and limited conversation to collaborators on Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: compilerarea: performanceregressionstate: has PR

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions