perf(electron/js): index IPC/package/file lookups and fuse summary passes (#13510)

perf(electron/js): index IPC/package/file lookups and fuse summary passes (#13507)
This commit is contained in:
morluto authored and GitHub committed 2026-11-22 12:57:07 -05:00
1 parent 0eaea650c0
commit 5262268826
4 files changed
+185 -128

No files matched your search

@@ -171,6 +171,23 @@ function* buildJavaScriptArtifactGraphInputSteps(
const unavailableFilesByPath = new Map(
fileSet.unavailable_relevant_files.map((file) => [file.path, file]),
);
const packagesByPath = new Map<
string,
JavaScriptArtifactAnalysis["packages"][number]
>();
for (const pkg of analysis.packages)
if (!packagesByPath.has(pkg.path)) packagesByPath.set(pkg.path, pkg);
const indexAnalyzedFiles = (
files: JavaScriptArtifactAnalysis["files"],
): ReadonlyMap<string, JavaScriptArtifactAnalysis["files"][number]> => {
const byPath = new Map<
string,
JavaScriptArtifactAnalysis["files"][number]
>();
for (const entry of files)
if (!byPath.has(entry.file.path)) byPath.set(entry.file.path, entry);
return byPath;
};
const context: JavaScriptArtifactGraphContext = {
accumulator,
snapshot,
@@ -183,6 +200,8 @@ function* buildJavaScriptArtifactGraphInputSteps(
),
root,
filesByPath: new Map(fileSet.files.map((file) => [file.path, file])),
analyzedFilesByPath: indexAnalyzedFiles(analysis.files),
packagesByPath,
unanalyzedFiles: {
coverage: snapshot.coverage,
get: (path) =>
@@ -210,15 +229,17 @@ function* buildJavaScriptArtifactGraphInputSteps(
yield;
// Raw observations remain on the file nodes. Only admitted expansions feed
// the relationship builders, including their Electron and bundler callers.
const projectionContext = {
const projectedFiles = analysis.files.map((file) =>
file.application_projection_failure === undefined
? file
: { ...file, javascript: null, semantic: null },
);
const projectionContext: JavaScriptArtifactGraphContext = {
...context,
analyzedFilesByPath: indexAnalyzedFiles(projectedFiles),
analysis: {
...analysis,
files: analysis.files.map((file) =>
file.application_projection_failure === undefined
? file
: { ...file, javascript: null, semantic: null },
),
files: projectedFiles,
},
};
const packageRoots = addJavaScriptPackageNodes(projectionContext);