Skip to content

perf(search): reuse directory-relative metadata snapshots - #945

Draft
Haoming9527 wants to merge 1 commit into
work/872-channel-wakeupfrom
work/872-scan-metadata
Draft

Haoming9527 wants to merge 1 commit into
work/872-channel-wakeupfrom
work/872-scan-metadata

Conversation

@Haoming9527

@Haoming9527 Haoming9527 commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #872 and #932. Stacked on #944; full performance acceptance remains open.

What was wrong

Search classified every directory entry twice: once through its held directory handle and again by absolute path. The relative no-follow metadata already contains symlink type and Windows reparse attributes. On the same 2,000-file corpus, a complete glob incurred 2,000 unnecessary absolute metadata queries.

The change

Reuse the directory-relative metadata for link/reparse classification. Keep content opens, child-directory no-follow checks, scan budgets, full revisions, output limits and continuation validation unchanged.

Add a diagnostic query-count regression and a real directory-link/junction exclusion test. Include raw alternating-order measurements and bilingual performance notes. No dependencies, public schemas, or runtime pins changed.

Validation

  • cargo test --locked --manifest-path native/Cargo.toml -p ops-search: passed; the optional writable-UNC fixture remains ignored locally.
  • cargo clippy --locked --manifest-path native/Cargo.toml -p ops-search --all-targets -- -D warnings: passed.
  • The new metadata-count assertion fails on the unchanged perf(shell): wake sealed channel readers without polling #944 worker (8 duplicate absolute queries for 8 fixture files) and passes on the candidate.
  • search-profiling, search-coverage, search-early-exit, grep-pagination, grep-multiline, grep-definitions: 30 checks passed across 6 suites, no skips/failures, using this worktree's release worker.
  • node scripts/check-file-size.mjs and git diff --check: passed.
  • PR-triggered CI required: awaiting this PR's run. No full local gate is claimed for this slice.

Unmodified bench/search-profile.mjs, 20 measured pairs plus three retained first-touch/warmup pairs per query, alternating order, same 2,000-file corpus (62,890 bytes):

Query Before p50 / p95 After p50 / p95
Exact grep 2913.57 / 3076.74 ms 2795.38 / 2961.94 ms
Bounded grep (5 files) 32.11 / 39.47 ms 32.28 / 38.86 ms
Missing pattern 2858.60 / 3001.79 ms 2750.02 / 2978.18 ms
Glob 367.09 / 404.41 ms 234.57 / 252.51 ms

Every canonical result matched and the corpus remained unchanged. This is a supplemental native one-shot benchmark including process startup and diagnostic clocks, not the attached 106-operation shell scenario. Full-scan grep still falls far short of the acceptance target; bounded scans are not substituted for complete scans. The profile attributes most remaining grep cost to per-file checked opens.

Environment

Windows x64, Ryzen 7 6800HS, Node 26.12.1, Rust 1.97.1 release, independent Cargo target directory. Baseline #944 at 24ac360551c1336453b78268090574f97a1de50a has all 10 CI jobs green: https://github.com/T-Auto/dsh-ops/actions/runs/43608861159.

Evidence and exact worker/corpus hashes.

Pull-request-triggered CI: all 10 jobs passed, including CI required and the Windows/Linux/macOS full gates: https://github.com/T-Auto/dsh-ops/actions/runs/43610781867.

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