diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-11-05 18:22:51 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-11-05 18:34:11 -0400 |
commit | 42908282b410077eb7b01325a5257f5441dd0873 (patch) | |
tree | ed608533214bd7ba5a3298a1027872f5d0ce0788 | |
parent | ff9ebc7232645971783c444d9a58953ebfd2da37 (diff) |
upd8: separate precacheCommonData step for better perf isolation
-rwxr-xr-x | src/upd8.js | 87 |
1 files changed, 78 insertions, 9 deletions
diff --git a/src/upd8.js b/src/upd8.js index 59be9473..15247878 100755 --- a/src/upd8.js +++ b/src/upd8.js @@ -132,6 +132,9 @@ async function main() { linkWikiDataArrays: {...defaultStepStatus, name: `link wiki data arrays`}, + precacheCommonData: + {...defaultStepStatus, name: `precache common data`}, + filterDuplicateDirectories: {...defaultStepStatus, name: `filter duplicate directories`}, @@ -141,8 +144,8 @@ async function main() { sortWikiDataArrays: {...defaultStepStatus, name: `sort wiki data arrays`}, - precacheData: - {...defaultStepStatus, name: `precache data`}, + precacheAllData: + {...defaultStepStatus, name: `precache nearly all data`}, loadInternalDefaultLanguage: {...defaultStepStatus, name: `load internal default language`}, @@ -462,7 +465,7 @@ async function main() { const showAggregateTraces = cliOptions['show-traces'] ?? false; - const precacheData = cliOptions['precache-data'] ?? false; + const precacheAllData = cliOptions['precache-data'] ?? false; const showInvalidPropertyAccesses = cliOptions['show-invalid-property-accesses'] ?? false; // Makes writing nicer on the CPU and file I/O parts of the OS, with a @@ -525,8 +528,8 @@ async function main() { }); } - if (!precacheData) { - Object.assign(stepStatusSummary.precacheData, { + if (!precacheAllData) { + Object.assign(stepStatusSummary.precacheAllData, { status: STATUS_NOT_APPLICABLE, annotation: `--precache-data not provided`, }); @@ -866,6 +869,72 @@ async function main() { timeEnd: Date.now(), }); + Object.assign(stepStatusSummary.precacheCommonData, { + status: STATUS_STARTED_NOT_DONE, + timeStart: Date.now(), + }); + + const commonDataMap = { + albumData: new Set([ + // Needed for sorting + 'date', 'tracks', + // Needed for computing page paths + 'commentary', + ]), + + artTagData: new Set([ + // Needed for computing page paths + 'isContentWarning', + ]), + + artistAliasData: new Set([ + // Needed for computing page paths + 'aliasedArtist', + ]), + + flashData: new Set([ + // Needed for sorting + 'act', 'date', + ]), + + flashActData: new Set([ + // Needed for sorting + 'flashes', + ]), + + groupData: new Set([ + // Needed for computing page paths + 'albums', + ]), + + listingSpec: new Set([ + // Needed for computing page paths + 'contentFunction', 'featureFlag', + ]), + + trackData: new Set([ + // Needed for sorting + 'album', 'date', + // Needed for computing page paths + 'commentary', + ]), + }; + + for (const [wikiDataKey, properties] of Object.entries(commonDataMap)) { + const thingData = wikiData[wikiDataKey]; + const allProperties = new Set(['name', 'directory', ...properties]); + for (const thing of thingData) { + for (const property of allProperties) { + void thing[property]; + } + } + } + + Object.assign(stepStatusSummary.precacheCommonData, { + status: STATUS_DONE_CLEAN, + timeEnd: Date.now(), + }); + // Filter out any things with duplicate directories throughout the data, // warning about them too. @@ -952,8 +1021,8 @@ async function main() { timeEnd: Date.now(), }); - if (precacheData) { - Object.assign(stepStatusSummary.precacheData, { + if (precacheAllData) { + Object.assign(stepStatusSummary.precacheAllData, { status: STATUS_STARTED_NOT_DONE, timeStart: Date.now(), }); @@ -970,7 +1039,7 @@ async function main() { .flatMap(([_key, things]) => things) .map(thing => () => CacheableObject.cacheAllExposedProperties(thing))); - Object.assign(stepStatusSummary.precacheData, { + Object.assign(stepStatusSummary.precacheAllData, { status: STATUS_DONE_CLEAN, timeEnd: Date.now(), }); @@ -979,7 +1048,7 @@ async function main() { if (noBuild) { displayCompositeCacheAnalysis(); - if (precacheData) { + if (precacheAllData) { return true; } } |