Skip to content

perf(@angular/build): reuse precomputed hash for in-memory build asset ETags - #34641

Merged
alan-agius4 merged 1 commit into
angular:mainfrom
alan-agius4:perf/build-assets-middleware-etag
Nov 3, 2026
Merged

alan-agius4 merged 1 commit into
angular:mainfrom
alan-agius4:perf/build-assets-middleware-etag

Conversation

@alan-agius4

Copy link
Copy Markdown
Collaborator

Reuse the precomputed outputFile.hash on in-memory ResultFile entries in createBuildAssetsMiddleware instead of recomputing a SHA256 digest on every HTTP request.

…t ETags

Reuse the precomputed outputFile.hash on in-memory ResultFile entries in createBuildAssetsMiddleware instead of recomputing a SHA256 digest on every HTTP request.
@angular-robot angular-robot Bot added area: performance Issues related to performance area: @angular/build labels Nov 3, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request optimizes the Vite assets middleware by utilizing precomputed hashes for memory-based output files instead of recalculating them on every request, and adds comprehensive unit tests to verify this behavior. The feedback suggests adding a fallback to calculate the hash if outputFile.hash is undefined to prevent invalid ETags.

@alan-agius4 alan-agius4 added target: patch This PR is targeted for the next patch release action: review The PR is still awaiting reviews from at least one requested reviewer labels Nov 3, 2026
@alan-agius4
alan-agius4 requested review from AleksanderBodurri and clydin and removed request for AleksanderBodurri November 3, 2026 08:52
@alan-agius4 alan-agius4 added target: minor This PR is targeted for the next minor release and removed target: patch This PR is targeted for the next patch release labels Nov 3, 2026
@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 Nov 3, 2026
@alan-agius4
alan-agius4 merged commit a84f9fa into angular:main Nov 3, 2026
45 checks passed
@alan-agius4
alan-agius4 deleted the perf/build-assets-middleware-etag branch November 3, 2026 14:24
@alan-agius4

Copy link
Copy Markdown
Collaborator Author

This PR was merged into the repository. The changes were merged into the following branches:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build area: performance Issues related to performance target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants