Skip to content

perf(index): skip the duplicate edge-index rebuild in the parse window - #611

Merged
bompus merged 3 commits into
fork/consolidatedfrom
probe/parse-edge-defer
Nov 1, 2026
Merged

bompus merged 3 commits into
fork/consolidatedfrom
probe/parse-edge-defer

Conversation

@bompus

@bompus bompus commented Nov 1, 2026

Copy link
Copy Markdown
Owner

What changed

  • A fresh full index drops the edge indexes in beginBulkParseLoad; endBulkParseLoad rebuilt them, and the batched resolver immediately dropped them again for its own bulk-edge window.
  • endBulkParseLoad(deferEdgeIndexes) now lets indexAll skip that first rebuild when the resolver's window will engage (pending refs >= minRefsForBulkLoad). The resolver's endBulkEdgeLoad rebuilds them after resolution. A run below the window rebuilds in the parse phase as before.

Measured (n8n, 2 runs per arm, admission passed)

Arm Total parse-index-rebuild edge-index-recreate
base 53.24 / 52.03 s 4,480 / 4,460 ms 1,530 / 1,454 ms
defer 51.45 / 51.09 s 4,023 / 4,017 ms 1,478 / 1,451 ms
  • The parse-phase rebuild is 0.44 s faster in both runs; the total is ~1.37 s faster but the base spread is 1.2 s, so the parse-phase figure is the clean evidence.
  • Edge index count (5) and edge rows (1,236,342) are identical in every run.

Tests

  • Full npx vitest run: 958 files, 11,345 passed, 46 skipped, 0 failed.

README impact

The README measured-results table predates this change; n8n's index figure will move. Re-measuring the corpora is heavy and is recorded as a follow-up rather than hand-editing one row.

A fresh full index drops the edge indexes in beginBulkParseLoad, then
endBulkParseLoad rebuilt them, and the batched resolver immediately
dropped them again for its own bulk-edge window. When the resolver's
window will engage (pending refs >= minRefsForBulkLoad), defer the edge
rebuild to the resolver's endBulkEdgeLoad. Small indexes that stay below
the window rebuild in the parse phase as before.

n8n: parse-index-rebuild 4.47 -> 4.02 s; the resolver's edge recreate
still runs; total 52.64 -> 51.27 s across two runs per arm. Edge index
count (5) and edge rows (1,236,342) are unchanged.
@bompus bompus added the author:deepseek Pull request written by a deepseek model label Nov 1, 2026

@bompus-ai-review bompus-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bompus AI Review (GPT-6.1 Terra, max reasoning): 1 finding(s).

Comment thread src/codegraph.ts Resolved
Review of #611: the parse finally deferred the edge rebuild whenever the
pending count cleared the bulk threshold, even when extraction returned
success: false and the resolver (the only other rebuilder) was skipped.
Defer only after successful parsing, and track the deferral through the
outer finally so an aborted or short-circuited run rebuilds the indexes.
Rebuilding after the resolver already did is a CREATE IF NOT EXISTS
no-op. Test pins the defer/restore pair.

@bompus-ai-review bompus-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bompus AI Review (GPT-6.1 Terra, max reasoning): 1 finding(s).

Comment thread src/codegraph.ts Resolved
Review of #611: a failed abort-path rebuild was swallowed, and the
existing connection's off-thread recoverer did not know the indexes
were missing. Register them with deferIndexRecovery() and run
recoverIndexesOffThread() (its own connection, 30s busy timeout); a
failed recovery leaves them registered for the next open and logs the
failure. Test covers the deferred-register/recover path.

@bompus-ai-review bompus-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bompus AI Review (GPT-6.1 Terra, max reasoning): 0 finding(s).

Review 3: only high findings and above are posted from here on.

@bompus
bompus merged commit 47839cc into fork/consolidated Nov 1, 2026
3 checks passed
@bompus
bompus deleted the probe/parse-edge-defer branch November 1, 2026 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author:deepseek Pull request written by a deepseek model

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant