Skip to content

Commit 34f1715

Browse files
committed
test(@angular/build): add large-enterprise-10k benchmark scenario
Adds a large-scale stress test scenario to the i18n inliner benchmark suite with 10,000 translation messages across 32 locales. The scenario generates a 3 MB main bundle and 100 route chunks with source maps, evaluating binary translation catalog encoding, small file batching, and memory scaling under maximum enterprise workloads.
1 parent c86373d commit 34f1715

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

scripts/benchmarks/i18n/scenarios.mts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,11 +384,60 @@ export function createPersistentCacheWarmScenario(
384384
};
385385
}
386386

387+
/**
388+
* 6. Large Enterprise (10k translations) Scenario:
389+
* 1 main bundle (3 MB) + 40 chunks (60 KB), 32 locales, 10,000 translations, sourcemaps ON.
390+
* Maximum scale stress test for binary translation tables, memory retention, and multi-locale windows.
391+
*/
392+
export function createLargeEnterpriseScenario(
393+
options: ScenarioFactoryOptions = {},
394+
): BenchmarkScenario {
395+
let workload: GeneratedWorkload | undefined;
396+
397+
return {
398+
name: 'large-enterprise-10k',
399+
description:
400+
'Large Enterprise (10k msgs): 1 main (3 MB) + 100 chunks (50 KB), 32 locales, 10,000 translations',
401+
get inputSizeBytes() {
402+
return workload?.totalInputSizeBytes ?? 0;
403+
},
404+
get localeCount() {
405+
return DEFAULT_LOCALES_32.length;
406+
},
407+
async setup() {
408+
await initializeFixtures();
409+
const files = createBundleSet(3 * 1024 * 1024, 100, 50 * 1024, 10000, true);
410+
const locales = generateTranslations(DEFAULT_LOCALES_32, 10000);
411+
412+
workload = {
413+
files,
414+
locales,
415+
totalInputSizeBytes: calculateInputSizeBytes(files),
416+
};
417+
},
418+
async run() {
419+
if (!workload) {
420+
return;
421+
}
422+
const inliner = new I18nInliner({
423+
missingTranslation: 'warning',
424+
maxConcurrency: options.concurrency,
425+
});
426+
try {
427+
await inliner.inlineAll(workload.files, workload.locales);
428+
} finally {
429+
await inliner.close();
430+
}
431+
},
432+
};
433+
}
434+
387435
export function getAllScenarios(options: ScenarioFactoryOptions = {}): BenchmarkScenario[] {
388436
return [
389437
createStandardAppScenario(options),
390438
createStandardAppNoMapsScenario(options),
391439
createEnterpriseScenario(options),
440+
createLargeEnterpriseScenario(options),
392441
createMonolithicScenario(options),
393442
createPersistentCacheWarmScenario(options),
394443
];

0 commit comments

Comments
 (0)