mirror of
https://github.com/morluto/rea
synced 2026-10-26 22:28:27 -04:00
perf(javascript): share one definitions pass and index wrapper IPC dedupe (#3779)
Static analysis rebuilt the full lexical definitions index three times per file (open receivers, RPC client roots, binding lookup) and the Electron wrapper pass checked each substituted IPC registration against every prior finding with JSON.stringify, which is quadratic in registrations. Classify open receivers and RPC client roots in one traversal over a single definitions-only index, then extend that same state with ambient writes for binding lookup. Index IPC findings by side, operation, channel and location so duplicate checks only consult same-endpoint candidates. Static facts are byte-identical on the measured corpora. Refs #3670 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,8 +5,8 @@ import {
|
||||
analyzeParsedJavaScriptSemanticsSteps,
|
||||
classifyParsedJavaScriptElectronBindings,
|
||||
classifyParsedJavaScriptElectronBindingsSteps,
|
||||
classifyParsedJavaScriptOpenReceivers,
|
||||
classifyParsedJavaScriptOpenReceiversSteps,
|
||||
classifyParsedJavaScriptReceivers,
|
||||
classifyParsedJavaScriptReceiversSteps,
|
||||
} from "./javascriptSemanticAnalysis.js";
|
||||
import { parseJavaScriptSource } from "./javascriptSourceParser.js";
|
||||
import {
|
||||
@@ -110,15 +110,15 @@ new NativeWindow();
|
||||
`;
|
||||
const parsed = parseJavaScriptSource(text, "receivers.js");
|
||||
if (parsed === null) throw new Error("Expected parsed source");
|
||||
const openSteps = classifyParsedJavaScriptOpenReceiversSteps(parsed);
|
||||
const openSteps = classifyParsedJavaScriptReceiversSteps(parsed);
|
||||
let openStep = openSteps.next();
|
||||
expect(openStep.done).toBe(false);
|
||||
while (openStep.done !== true) openStep = openSteps.next();
|
||||
expect([...openStep.value]).toEqual([
|
||||
expect([...openStep.value.openReceivers]).toEqual([
|
||||
[text.indexOf('ambient.open("/local")'), "local"],
|
||||
[text.indexOf('ambient.open("/global")'), "window"],
|
||||
]);
|
||||
expect(openStep.value).toEqual(classifyParsedJavaScriptOpenReceivers(parsed));
|
||||
expect(openStep.value).toEqual(classifyParsedJavaScriptReceivers(parsed));
|
||||
|
||||
const electronSteps = classifyParsedJavaScriptElectronBindingsSteps(parsed);
|
||||
let electronStep = electronSteps.next();
|
||||
|
||||
Reference in New Issue
Block a user