perf(synthesis): provably-empty pass gates + prefilters — render/expo/rn/mybatis stop scanning repos they can't match; iface memo (#1389)
Store-arc round 2 (#1388 follow-up). The synthesis pool barrier on dubbo carried ~1.4s of passes that provably could not emit an edge for the project: reactRenderEdges fanned out over every class before checking for a render method (now: one indexed name lookup bounds candidates — not a language gate, Java Litho-style render+setState still matches); expo/rn cross-platform pairing streamed every method row without the languages their edges require (now registry-gated: expo needs swift AND kotlin file-languages, rn needs a JS-family caller for isBridge); mybatis built its full java-method index before discovering there were no mapper-XML methods (now collects the XML side first). ifaceEdges — real work — stops re-fetching a hub interface's methods once per implementer and skips supertype-less classes before any per-class lookup. dubbo warm wall 8.49-8.79 → 8.14-8.24s (n=3/arm, caffeinated); barrier 784→435ms; the full removed pass work lands on low-core envelopes where synthesis runs sequentially. Dumps byte-identical: dubbo old-vs-new, pooled-vs-sequential, kernel-vs-wasm (441,270 rows) + excalidraw JSX-live control (89,903 rows, 46 react-render edges reproduced). Suite 2,689 ×2 with CODEGRAPH_KERNEL_EXPECT=1. Also ships the diagnostics that located the round (zero cost when off): CODEGRAPH_RESOLVE_PROFILE=2 attributes per-ref time to resolveOne's strategies (stage:*) and the name-matcher's sub-matchers (nm:*); CODEGRAPH_SYNTH_TIMINGS now prints the store worker's decode-vs-SQL split. Killed by measurement, recorded in the PR: import-failure negative cache (both-outcome names exist — static imports resolve via instance-method on jvm-miss), jvm-miss early return (1,939 later-strategy edges), jsxEdges language gate (Java generics text produces jsx edges), and §4d buffer→bind on Spring repos (extract() hook forces the decoded path — kernel=0 bundles measured). Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
27c3c55436
commit
082ea65f3a
@@ -41,6 +41,15 @@ const port = parentPort;
|
||||
let db: SqliteDatabase | null = null;
|
||||
let queries: QueryBuilder | null = null;
|
||||
|
||||
// CODEGRAPH_SYNTH_TIMINGS: split the writer lane's busy time into its two
|
||||
// halves — kernel-buffer decode+finalize (JS-object materialization, the §4d
|
||||
// buffer→bind candidate) vs the SQL bundle store — printed once at close.
|
||||
const STORE_TIMINGS = !!process.env.CODEGRAPH_SYNTH_TIMINGS;
|
||||
let decodeNs = 0n;
|
||||
let storeNs = 0n;
|
||||
let bundleCount = 0;
|
||||
let kernelBundleCount = 0;
|
||||
|
||||
type InMessage =
|
||||
| { type: 'open'; dbPath: string; fastInit: boolean }
|
||||
| { type: 'bundle'; bundle: StoreBundle | KernelStoreBundle }
|
||||
@@ -88,6 +97,23 @@ port.on('message', (msg: InMessage) => {
|
||||
}
|
||||
case 'bundle': {
|
||||
if (!queries) throw new Error('store-worker: bundle before open');
|
||||
if (STORE_TIMINGS) {
|
||||
bundleCount++;
|
||||
const t0 = process.hrtime.bigint();
|
||||
let bundle: StoreBundle;
|
||||
if ('kernel' in msg.bundle) {
|
||||
kernelBundleCount++;
|
||||
bundle = decodeKernelBundle(msg.bundle);
|
||||
} else {
|
||||
bundle = msg.bundle;
|
||||
}
|
||||
const t1 = process.hrtime.bigint();
|
||||
queries.storeFileBundle(bundle);
|
||||
decodeNs += t1 - t0;
|
||||
storeNs += process.hrtime.bigint() - t1;
|
||||
port.postMessage({ type: 'ack' });
|
||||
break;
|
||||
}
|
||||
const bundle = 'kernel' in msg.bundle ? decodeKernelBundle(msg.bundle) : msg.bundle;
|
||||
queries.storeFileBundle(bundle);
|
||||
port.postMessage({ type: 'ack' });
|
||||
@@ -98,6 +124,11 @@ port.on('message', (msg: InMessage) => {
|
||||
break;
|
||||
}
|
||||
case 'close': {
|
||||
if (STORE_TIMINGS && bundleCount > 0) {
|
||||
console.error(
|
||||
`[store-timing] bundles=${bundleCount} (kernel=${kernelBundleCount}) decode=${(Number(decodeNs / 1_000_000n) / 1000).toFixed(2)}s store=${(Number(storeNs / 1_000_000n) / 1000).toFixed(2)}s`
|
||||
);
|
||||
}
|
||||
try {
|
||||
db?.close();
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user