feat: stream searches and add reproducible benchmarks - #41
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 59bb0a46d7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if !matcher.is_match(&entry) { | ||
| return WalkState::Continue; | ||
| } |
There was a problem hiding this comment.
Cancel dropped searches before finding a match
When a query has no matches in a large tree, dropping the iterator only disconnects the result receiver, but this branch never observes that disconnection and continues walking every entry. Since channel failure is checked only while sending a match or traversal error, rare- or no-match searches can leave detached walker threads consuming filesystem I/O long after callers stop using them, contrary to the documented prompt cancellation behavior.
Useful? React with 👍 / 👎.
| if types | ||
| .add("rust-search-extension", &format!("*.{extension}")) |
There was a problem hiding this comment.
Escape extensions before installing the glob prefilter
On filesystems that permit glob metacharacters in extensions, inputs such as .ext("?") or .ext("*") are interpreted as glob patterns rather than literal suffixes. TypesBuilder::add accepts these patterns, after which extension_prefiltered causes the exact extension comparison to be skipped, so ? matches every one-character extension and * matches arbitrary extensions; the prefilter must escape user input or retain the literal matcher.
Useful? React with 👍 / 👎.
Summary
Performance
On the same warm 100,000-file fixture, with equal 10,000-path outputs and 15 measured runs:
260286cThat is a 1.37x throughput improvement.
The reproducible 50,000-file tool comparison verifies identical sorted sets of 5,000 paths before timing:
See
BENCHMARKS.mdfor the environment, methodology, caveats, internal timings, and reproduction commands.Compatibility
This corrects two behaviors that callers may have observed despite the documented API:
search_inputis now literal text instead of implicitly interpreting regex punctuationSearch construction also returns before traversal completes. These changes are documented in
CHANGELOG.md; maintainers should consider whether the next publication warrants a major version.Verification
cargo fmt --all -- --checkcargo clippy --all-targets -- -D warnings