Skip to content

feat(stats): ripgrep-style --stats (matches, files, bytes, elapsed)#5

Merged
botirk38 merged 2 commits intomasterfrom
feat/stats-bytes-searched
Apr 3, 2026
Merged

feat(stats): ripgrep-style --stats (matches, files, bytes, elapsed)#5
botirk38 merged 2 commits intomasterfrom
feat/stats-bytes-searched

Conversation

@botirk38
Copy link
Copy Markdown
Owner

@botirk38 botirk38 commented Apr 3, 2026

Summary

Completes --stats / SearchStats toward ripgrep-style reporting:

  • matches: mode-dependent tally (unchanged semantics).
  • files_with_matches: files that had a positive hit for the current mode (see SearchStats docs; --files-without-match keeps this at 0).
  • files_searched: candidate count after filtering.
  • bytes_printed: bytes written to stdout (including heading separators between chunks).
  • bytes_searched: sum of std::fs::metadata().len() per candidate (approximates rg).
  • elapsed: wall time for the search phase.

Core

  • Wired atomics through index and walk paths (parallel StandardWorker / SummaryWorker and capped sequential paths).
  • StatsCollection bundles optional atomics to satisfy clippy without sprawl.

CLI

Stderr lines (order aligned with rg): matches → files contained matches → files searched → bytes printed → bytes searched → elapsed.

Tests / docs

  • crates/cli/tests/integration_stats.rs updated.
  • docs/rg-compat-matrix.md --stats row updated.

Validation

cargo fmt --check, cargo clippy -D warnings, cargo test --workspace --all-features

botirk38 added 2 commits April 3, 2026 18:09
- Add SearchStats.bytes_searched (sum of metadata len per candidate)
- sum_candidate_file_bytes in execute for index and walk paths
- CLI --stats prints bytes line before elapsed
- integration_stats asserts bytes line; matrix notes rg parity not guaranteed
Wire files_with_matches and bytes_printed through index and walk search
paths (parallel and capped workers). Add StatsCollection to keep execute
helpers within clippy limits. Extend CLI stderr output and integration test;
refresh rg compat matrix for --stats.
@botirk38 botirk38 changed the title feat(stats): bytes searched in SearchStats and --stats feat(stats): ripgrep-style --stats (matches, files, bytes, elapsed) Apr 3, 2026
@botirk38 botirk38 merged commit 71c04b2 into master Apr 3, 2026
4 checks passed
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