Skip to content

[MWPW-TBD] Perf: parallelize personalization manifests and start lingo indexes earlier#6208

Closed
mokimo wants to merge 1 commit into
stagefrom
mokimo-perf-quick-wins
Closed

[MWPW-TBD] Perf: parallelize personalization manifests and start lingo indexes earlier#6208
mokimo wants to merge 1 commit into
stagefrom
mokimo-perf-quick-wins

Conversation

@mokimo

@mokimo mokimo commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Description

Quick-win performance improvements for the personalization + lingo pipeline.

1. getManifestConfig serial loop → Promise.all (personalization.js:1429)
Each manifest JSON fetch was blocking the next. Now all fetches fire in parallel.
Estimated gain: 300–800 ms on pages with 3+ manifests.

2. categorizeActions serial loop → Promise.all (personalization.js:1440)
categorizeActions is effectively synchronous but was wrapped in a serial for-await loop. Now runs via Promise.all — eliminates microtask waterfall.

3. getEntitlementMap in-flight dedup (personalization.js:1017)
When getManifestConfig calls run concurrently via Promise.all, each calls getPersonalizationVariantgetEntitlementMap. Without dedup, N concurrent callers each issued a separate XLG tags fetch. Fixed by caching the in-flight promise on config.mep.entitlementMapFetch.

4. loadLingoIndexes before decorateDocumentExtras (utils.js:2757)
Sections (.section class) are now set up before decorateDocumentExtras() is awaited, so query-index fetches start while header/meta decoration runs.
Estimated gain: overlaps ~100–300 ms of decorateDocumentExtras latency.

5. Query index URL dedup (utils.js:747)
loadQueryIndexes was calling processQueryIndexMap twice with the same URL on prod/live when the locale prefix resolves to the same path for both the primary and base index. Now shares one in-flight fetch object.

6. market.js modulepreload before preview.js import (personalization.js:1722)
preview.js has a static import of market.js, creating a serial fetch waterfall. A modulepreload hint for market.js added right before the dynamic import('./preview.js') call lets both load in parallel.

Resolves: MWPW-TBD

Test URLs (da-cc fr/creativecloud):

milo aem.page:

🤖 Generated with Claude Code

…dexes earlier

- Parallelize getManifestConfig() calls with Promise.all (was serial for-loop) — 300-800ms gain on pages with multiple manifests
- Parallelize categorizeActions() calls with Promise.all (synchronous but eliminates microtask overhead)
- Add in-flight promise dedup to getEntitlementMap() so concurrent callers share one XLG tags fetch instead of each issuing their own
- Move section setup and loadLingoIndexes() before decorateDocumentExtras() so query-index fetches start while header/meta decoration runs (parallel instead of serial)
- Deduplicate processQueryIndexMap calls when primary and base locale URLs resolve to the same path (avoids double-fetch on prod with root locale)
- Add market.js modulepreload hint before the preview.js dynamic import so both modules load in parallel

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mokimo mokimo requested a review from a team as a code owner June 22, 2026 13:20
@aem-code-sync

aem-code-sync Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-sync branch
Commits

if (result) results.push(result);
}
results = results.filter(Boolean);
results = (await Promise.all(experiments.map((exp) => categorizeActions(exp, config)))).filter(Boolean);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚫 [eslint] <max-len> reported by reviewdog 🐶
This line has a length of 106. Maximum allowed is 100.

Comment thread libs/utils/utils.js
if (localeBase !== undefined) basePfx = localeBase ? `/${localeBase}` : '';
baseQueryIndex = processQueryIndexMap(indexUrl(basePfx, ''), host);
const baseUrl = indexUrl(basePfx, '');
baseQueryIndex = primaryUrl === baseUrl ? queryIndexes[siteId] : processQueryIndexMap(baseUrl, host);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚫 [eslint] <max-len> reported by reviewdog 🐶
This line has a length of 103. Maximum allowed is 100.

@mokimo

mokimo commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Closed in favor of #6210

@mokimo mokimo closed this Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant