Repository navigation
perf(sync): index the synthesis-touch check through edges.provenance - #581
Merged
Merged
Conversation
The gate added in #580 pays its check on every sync: the bulk filesTouchingSynthesizedEdges() scanned all edges twice with a per-row json_extract (~1.98 s on n8n's 1.2M-edge table), and the per-file registeredAt leg was an unindexed full scan (~135 ms). 'n8n watchSync' measured the cost: fork ~1.9 s vs upstream ~0.97 s. provenance='heuristic' is a strict superset of synthesizedBy edges, so a provenance predicate narrows every leg through idx_edges_provenance (~22k rows) before json_extract: bulk 1978->32ms, per-file leg 135->4ms, same result set (3001 files verified equal on the n8n db). Small syncs (<=64 checked files) now also take the per-file indexed probes instead of building the bulk set at all.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Owner
Author
|
@coderabbitai review |
|
The MCP table carried bc27fdb; re-measured at 5784e28 on a clean single-writer pass (Bun arms median of two, Node arms single). Busy memory flipped from the run's one regression (4.54 -> 2.95 GiB vs upstream's 3.83) and the fork now idles lower on every arm. The new flag is Edited file re-indexed — which is the gate's own edge scan, root-caused and fixed in this PR's provenance narrowing, not resynthesis.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
filesTouchingSynthesizedEdges()on the first changed file of every sync: two full scans ofedgeswith a per-rowjson_extract— 1.98 s on n8n's 1.2M-edge table — andhasSynthesizedEdgesTouchingFile'sregisteredAtleg was a full scan per call (~135 ms). That scan is the n8nwatchSyncregression: fork ~1.9 s vs upstream ~0.97 s.provenance='heuristic'is a strict superset ofsynthesizedByedges (verified on the live n8n db: 21,880 ⊇ 9,490), so adding it narrows every leg throughidx_edges_provenancebefore any JSON work.Test plan
sync-resynthesis,sync-rebuild-convergence)