Skip to content

perf(files): optimize file search delete batches#489

Closed
JustYannicc wants to merge 1 commit into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-file-search-delete-batch
Closed

perf(files): optimize file search delete batches#489
JustYannicc wants to merge 1 commit into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-file-search-delete-batch

Conversation

@JustYannicc

Copy link
Copy Markdown
Collaborator

Summary

  • Collapse nested watcher delete paths before tombstoning the file-search index.
  • Replace the entries x delete-prefix scan with direct-id tombstones plus descendant prefix/ancestor-set matching.
  • Add a focused synthetic benchmark and regression coverage for file deletes, directory deletes, nested delete collapse, and non-matching prefix-like paths.

Benchmark

Command: node scripts/benchmark-file-search-delete-batch.mjs

Synthetic scenario: 68,162 index entries, 4,041 nested delete paths, 8,041 tombstoned entries.

  • Before: 13,295.52 ms
  • After: 21.42 ms final run (observed after runs: 16.41 ms, 15.85 ms, 25.38 ms, 21.42 ms)
  • Improvement: about 621x faster on the final run

Validation

  • node --test scripts/test-file-search-delete-batch.mjs
  • node --test 'scripts/test-*.mjs' (passes; live Electron test skipped because Electron is not launchable here)
  • Codex LSP diagnostics on src/main/file-search-index.ts: no errors
  • pnpm run build:main
  • pnpm run check:i18n exited 0; it still reports pre-existing Italian locale gaps for settings.ai.whisper.vocabulary and settings.extensions.appSearchScope, and this PR does not touch user-facing strings

Risks

  • Delete matching remains string/path based and preserves the previous case-sensitive behavior.
  • Tombstoned entries remain in pathToEntryId as before, so re-added paths can clear the deleted flag through indexEntry.

@JustYannicc JustYannicc changed the title [codex] optimize file search delete batches perf(files): optimize file search delete batches Jul 3, 2026
@JustYannicc

Copy link
Copy Markdown
Collaborator Author

Superseded by the consolidated upstream PR #535: #535

@JustYannicc JustYannicc closed this Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant