Skip to content

ESBuild is very slow!!! #29231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task
xjlzy opened this issue Dec 27, 2024 · 2 comments
Closed
1 task

ESBuild is very slow!!! #29231

xjlzy opened this issue Dec 27, 2024 · 2 comments
Labels
needs: investigation Requires some digging to determine if action is needed

Comments

@xjlzy
Copy link

xjlzy commented Dec 27, 2024

Command

serve, 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

No response

Description

I created a project through Angular/[email protected]. This project contains ten thousand components, which are distributed into one hundred modules. These codes take up approximately 20MB of disk space. When I execute the default dev-server builder, it takes about 300 seconds or so. Then, when performing an incremental build after modifying the files for the first time, it also takes around 300 seconds to complete the build. And the incremental compilation time after modifying the files later is about 15 seconds or so. Moreover, it occupies a huge amount of memory. The processes of Node.js and Esbuild take up approximately 14GB of memory.

Minimal Reproduction

https://github.com/xjlzy/test.git
This is the git repository address of my local test code. You just need to run it and you'll be able to know the specific situation. I hope to reduce the time for the first incremental build and also lower the memory usage.

Exception or Error


Your Environment

Angular CLI: 18.2.12
Node: 22.11.0
Package Manager: yarn 1.22.22
OS: win32 x64

Angular: 18.2.13
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1802.12
@angular-devkit/build-angular   18.2.12
@angular-devkit/core            18.2.12
@angular-devkit/schematics      18.2.12
@angular/cli                    18.2.12
@schematics/angular             18.2.12
rxjs                            7.8.1
typescript                      5.5.4
zone.js                         0.14.10

Anything else relevant?

OS: Windows 11 Home 24H2
memory: 32GB
CPU: Intel(R) Core(TM) Ultra 7 155H 3.80 GHz

@alan-agius4 alan-agius4 added the needs: investigation Requires some digging to determine if action is needed label Jan 6, 2025
@alan-agius4
Copy link
Collaborator

I reviewed the situation, and the primary cause of the initial delay is TypeScript, which is also noticeable when running directly with TSC. Additionally, the delay persists during the first incremental change because TypeScript needs to generate a new program when the initial update occurs.

The main.js file for the application is 103.68MB, which is quite large. Considering the file size, it's clear that the system is struggling and consuming significant resources.

Overall, the core issue appears to be the application's structure. There's simply too much code to process, with 41MB of TypeScript source files adding considerable load.

Switching from ngModule to standalone components should improve build times. For more details, check out this migration guide: https://angular.dev/reference/migrations/standalone)](https://angular.dev/reference/migrations/standalone

@alan-agius4 alan-agius4 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 6, 2025
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: investigation Requires some digging to determine if action is needed
Projects
None yet
Development

No branches or pull requests

2 participants