Skip to content
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

perf(@angular-devkit/build-angular): reduce build times for apps with a large number of components when utilizing esbuild-based builders #27281

Merged
merged 2 commits into from Mar 14, 2024

Conversation

alan-agius4
Copy link
Collaborator

@alan-agius4 alan-agius4 commented Mar 14, 2024

In this commit, we've optimized the build performance for applications containing a large number of components when using the esbuild-based builder. This optimization entails replacing the spread operator with Object.assign when appending to the result metadata in the Angular compiler plugin to avoid creating multiple copies of the object.

See: https://bugs.chromium.org/p/v8/issues/detail?id=11536

Previous Performance:

  • Initial compilation: 37 seconds
  • First incremental build: 20 seconds
  • Second incremental build: 16 seconds

Updated Performance:

  • Initial compilation: 24 seconds
  • First incremental build: 6 seconds
  • Second incremental build: 2 seconds

Closes #27280

@alan-agius4 alan-agius4 requested a review from clydin March 14, 2024 13:04
@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Mar 14, 2024
@alan-agius4 alan-agius4 force-pushed the esbuild-perf-object branch 3 times, most recently from d9562cf to 380d795 Compare March 14, 2024 13:41
… a large number of components when utilizing esbuild-based builders

In this commit, we've optimized the build performance for applications containing a large number of components when using the esbuild-based builder. This optimization entails replacing the spread operator with `Object.assign` when appending to the result metadata in the Angular compiler plugin to avoid creating multiple copies of the object.

See: https://bugs.chromium.org/p/v8/issues/detail?id=11536

**Previous Performance**:
- Initial compilation: 37 seconds
- First incremental build: 20 seconds
- Second incremental build: 16 seconds

**Updated Performance**:
- Initial compilation: 24 seconds
- First incremental build: 6 seconds
- Second incremental build: 2 seconds

Closes angular#27280
This commit removes an unused imported symbol.
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Mar 14, 2024
@alan-agius4 alan-agius4 merged commit 2fb4b24 into angular:main Mar 14, 2024
33 checks passed
@alan-agius4 alan-agius4 deleted the esbuild-perf-object branch March 14, 2024 14:20
@@ -420,8 +420,11 @@ export function createCompilerPlugin(

// Combine additional metafiles with main metafile
if (result.metafile && metafile) {
result.metafile.inputs = { ...result.metafile.inputs, ...metafile.inputs };
result.metafile.outputs = { ...result.metafile.outputs, ...metafile.outputs };
// Append the existing object, by appending to it we prevent unnecessary new objections creations with spread

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor typo: objections -> object :)

@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 Apr 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

incremental rebuilds with "application" builder are 2-3 times slower
3 participants