FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

perf(@angular/build): avoid sharding intermediate files under worker … · angular/angular-cli@3d08e5b · GitHub

Repository navigation

Commit 3d08e5b

Browse files
committed
perf(@angular/build): avoid sharding intermediate files under worker surplus in i18n inliner
When the number of uncached files in an inlining window meets or exceeds the worker pool concurrency, the thread pool already has sufficient file-level parallelism to keep all workers fully utilized. Previously, all intermediate files (files between 100 KB and 70% of the maximum file size) were sharded into batches of half their locales regardless of the total file count. In applications with many chunks, this doubled the number of worker tasks and forced multiple worker threads to independently parse the same JavaScript file and decode the same source map. Intermediate files are now processed with all window locales in a single batch whenever the file count is greater than or equal to the worker thread count. This halves the task count for intermediate chunks, eliminates redundant AST and sourcemap parsing across threads, and reduces IPC and scheduling overhead. (cherry picked from commit 790eed3)
1 parent b198044 commit 3d08e5b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎packages/angular/build/src/tools/i18n/i18n-inliner.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,12 @@ export class I18nInliner {
540540
// at least one worker to process smaller chunks in parallel without starvation.
541541
const targetWorkers = Math.max(1, Math.min(workerCount - 1, MAX_DOMINANT_WORKERS));
542542
localesPerBatch = Math.max(1, Math.ceil(entries.length / targetWorkers));
543+
} else if (uncachedByFile.size >= workerCount) {
544+
// Worker pool is already saturated by file-level concurrency;
545+
// process all locales in a single batch to avoid duplicate parsing and IPC overhead.
546+
localesPerBatch = entries.length;
543547
} else {
544-
// Intermediate files: moderate sharding
548+
// Intermediate files with idle workers: moderate sharding
545549
localesPerBatch = Math.max(1, Math.ceil(entries.length / 2));
546550
}
547551

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL