perf(@angular/build): batch prerender routes and share in-memory server bundles - #33905
Merged
alan-agius4 merged 1 commit intoAug 25, 2026
Conversation
alan-agius4
force-pushed
the
perf-prerender-route-batching-shared-bundles
branch
2 times, most recently
from
August 24, 2026 10:53
7986ca2 to
04e0890
Compare
alan-agius4
marked this pull request as ready for review
August 24, 2026 10:53
There was a problem hiding this comment.
Code Review
This pull request optimizes server-side prerendering by transitioning in-memory files to zero-copy Uint8Array buffers backed by SharedArrayBuffer and batching route rendering requests to reduce IPC overhead across worker threads. It also adds comprehensive unit tests for these changes. The feedback suggests adding an inline comment to explain the batching heuristic formula for better maintainability.
alan-agius4
force-pushed
the
perf-prerender-route-batching-shared-bundles
branch
from
August 24, 2026 10:58
04e0890 to
25db34e
Compare
…er bundles Back in-memory server bundles with SharedArrayBuffer to eliminate V8 structuredClone memory duplication across worker threads and loader hooks. Batch routes dynamically during prerendering to amortize IPC messaging and event loop scheduling overhead.
alan-agius4
force-pushed
the
perf-prerender-route-batching-shared-bundles
branch
from
August 24, 2026 11:05
25db34e to
6c170b2
Compare
clydin
approved these changes
Aug 24, 2026
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
Please check to confirm your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
workerDataas strings, causing V8structuredCloneserialization to copy all bundles into every worker thread isolate and ESM loader hook instance.prerender.ts,renderPagesdispatches individual tasks to Piscina worker threads for each route, introducing per-task IPC serialization and event loop scheduling overhead on large applications with thousands of routes.What is the new behavior?
Uint8Arrayviews backed bySharedArrayBufferviacreateSharedServerFiles, allowing zero-copy memory sharing across all worker threads and ESM loader hooks.render-worker.tsto support batch rendering requests while maintaining backward compatibility and per-route error trapping.Does this PR introduce a breaking change?