Skip to content

perf(search): bound candidate storage for early frecency pages - #963

Merged
dkovalenko-oai merged 2 commits into
perf/indexing-batchesfrom
perf/bound-frecency-pages
Nov 11, 2026
Merged

dkovalenko-oai merged 2 commits into
perf/indexing-batchesfrom
perf/bound-frecency-pages

Conversation

@dmtrKovalenko

@dmtrKovalenko dmtrKovalenko commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Keep the highest-ranked files from each chunk for small, early pages in large inventories. Count every live file and use the existing score comparison to preserve page order.

#873 builds worktree index layers on this PR’s filename ranking.


The fast path applies to inventories with at least 65,536 entries and pages ending within the first 128 results. The timings are warm medians from 15 repetitions on a 1.87-million-file repository. All pages matched the stock results, including total counts, scores and order.

Offset, 50 results per page #958 This change
0 25.06 ms 4.93 ms
63 24.74 ms 4.90 ms
1,000 25.16 ms 24.56 ms
3,500 24.97 ms 24.71 ms

This change uses the score comparison added in #958.

Review order

Summary by CodeRabbit

  • Performance
    • Improved responsiveness when browsing large file collections with small paginated result sets. Results continue to exclude deleted files and preserve the total count of matching files.
    • Pagination continues to return results in frecency order across pages, including when the number of results requested is small.

@dmtrKovalenko
dmtrKovalenko added this pull request to stack #964 October 23, 2026 22:58
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c9328539-c8e7-468c-9dc7-5fa78f10a9cc
Commits

Reviewing files that changed from the base of the PR and between 2fa8267 and 6814069.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

rank_by_frecency uses chunked top-candidate scoring for qualifying large, unfiltered file slices. Other cases use full frecency accumulation. Tests compare results across pages, thread counts, and current-file settings.

Changes: Frecency ranking

Layer / File(s) Summary
Bounded large-slice ranking
crates/fff-core/src/score.rs
For qualifying slices, ranking processes chunks, skips deleted files, counts live files, and retains top candidates. Other cases use full frecency accumulation. Tests cover 132,000- and 140,000-file inputs and compare bounded results with full ranking.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Possibly related PRs

Merge Risk: Minimal · previous review 3cf35

The bounded ranking preserves the existing ordering; no material merge risk was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: limiting candidate storage for early frecency search pages.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 1 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b8350941-f00c-4969-806c-940eb4ad010a
Commits

Reviewing files that changed from the base of the PR and between e6d99f5 and 3cf352e.

Files selected for processing: 1

  • crates/fff-core/src/score.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🥼 FFF core performance

✅ FFF core performance passed

Base 012980d, PR 6814069

🔴 0 slower, 🟢 3 faster, ⚪ 70 within ±10%

Benchmark Base PR Change
🟢 core/bigram/bigram_query_100000/long_14char 582 ns 327 ns -43.81%
🟢 core/bigram/bigram_query_100000/medium_6char 539 ns 286 ns -46.94%
🟢 core/bigram/bigram_query_100000/multi_word 560 ns 307 ns -45.18%

PR time against base for every benchmark

🔬 All 73 Criterion timings
Benchmark Base PR Change
⚪ ext4/fff/fuzzy_search/fuzzy_search_repo/empty/no_current_file 6.93 µs 7.13 µs +2.88%
⚪ ext4/fff/fuzzy_search/fuzzy_search_repo/short/current_file 104.65 µs 104.56 µs -0.09%
⚪ ext4/fff/fuzzy_search/fuzzy_search_repo/path/no_current_file 510.60 µs 522.04 µs +2.24%
⚪ ext4/fff/fuzzy_search/fuzzy_search_repo/multipart/current_file 36.46 µs 36.58 µs +0.32%
⚪ ext4/fff/fuzzy_search/fuzzy_search_repo/extension/no_current_file 10.02 µs 10.20 µs +1.75%
⚪ ext4/fff/grep/grep_repo/plain_sensitive 11.59 ms 11.13 ms -3.95%
⚪ ext4/fff/grep/grep_repo/plain_insensitive 7.84 ms 7.58 ms -3.33%
⚪ ext4/fff/grep/grep_repo/plain_no_matches 11.41 ms 10.87 ms -4.71%
⚪ ext4/fff/grep/grep_repo/regex 11.63 ms 11.13 ms -4.28%
⚪ ext4/fff/grep/grep_repo/fuzzy_exact 6.30 ms 6.10 ms -3.16%
⚪ ext4/fff/grep/grep_repo/fuzzy_typo 6.35 ms 6.28 ms -1.12%
⚪ ext4/vscode/fuzzy_search/fuzzy_search_repo/empty/no_current_file 407.38 µs 414.94 µs +1.86%
⚪ ext4/vscode/fuzzy_search/fuzzy_search_repo/short/current_file 3.10 ms 3.40 ms +9.67%
⚪ ext4/vscode/fuzzy_search/fuzzy_search_repo/path/no_current_file 5.97 ms 6.04 ms +1.12%
⚪ ext4/vscode/fuzzy_search/fuzzy_search_repo/multipart/current_file 5.92 ms 6.23 ms +5.22%
⚪ ext4/vscode/fuzzy_search/fuzzy_search_repo/extension/no_current_file 124.89 µs 127.61 µs +2.18%
⚪ ext4/vscode/grep/grep_repo/plain_sensitive 8.29 ms 8.27 ms -0.20%
⚪ ext4/vscode/grep/grep_repo/plain_insensitive 8.36 ms 8.41 ms +0.52%
⚪ ext4/vscode/grep/grep_repo/plain_no_matches 105.00 ms 104.03 ms -0.92%
⚪ ext4/vscode/grep/grep_repo/regex 8.49 ms 8.43 ms -0.74%
⚪ ext4/vscode/grep/grep_repo/fuzzy_exact 8.19 ms 8.16 ms -0.33%
⚪ ext4/vscode/grep/grep_repo/fuzzy_typo 13.06 ms 13.14 ms +0.64%
⚪ btrfs/fff/fuzzy_search/fuzzy_search_repo/empty/no_current_file 6.99 µs 7.13 µs +2.07%
⚪ btrfs/fff/fuzzy_search/fuzzy_search_repo/short/current_file 106.41 µs 104.90 µs -1.41%
⚪ btrfs/fff/fuzzy_search/fuzzy_search_repo/path/no_current_file 506.74 µs 516.39 µs +1.90%
⚪ btrfs/fff/fuzzy_search/fuzzy_search_repo/multipart/current_file 36.52 µs 36.48 µs -0.12%
⚪ btrfs/fff/fuzzy_search/fuzzy_search_repo/extension/no_current_file 9.50 µs 9.63 µs +1.35%
⚪ btrfs/fff/grep/grep_repo/plain_sensitive 11.18 ms 10.79 ms -3.45%
⚪ btrfs/fff/grep/grep_repo/plain_insensitive 7.54 ms 7.50 ms -0.43%
⚪ btrfs/fff/grep/grep_repo/plain_no_matches 10.76 ms 10.75 ms -0.01%
⚪ btrfs/fff/grep/grep_repo/regex 11.65 ms 11.25 ms -3.47%
⚪ btrfs/fff/grep/grep_repo/fuzzy_exact 6.26 ms 6.13 ms -2.14%
⚪ btrfs/fff/grep/grep_repo/fuzzy_typo 6.37 ms 6.29 ms -1.37%
⚪ btrfs/vscode/fuzzy_search/fuzzy_search_repo/empty/no_current_file 391.39 µs 392.83 µs +0.37%
⚪ btrfs/vscode/fuzzy_search/fuzzy_search_repo/short/current_file 3.12 ms 3.39 ms +8.78%
⚪ btrfs/vscode/fuzzy_search/fuzzy_search_repo/path/no_current_file 6.03 ms 5.96 ms -1.18%
⚪ btrfs/vscode/fuzzy_search/fuzzy_search_repo/multipart/current_file 6.09 ms 6.21 ms +1.95%
⚪ btrfs/vscode/fuzzy_search/fuzzy_search_repo/extension/no_current_file 122.88 µs 126.89 µs +3.27%
⚪ btrfs/vscode/grep/grep_repo/plain_sensitive 18.31 ms 17.71 ms -3.26%
⚪ btrfs/vscode/grep/grep_repo/plain_insensitive 8.31 ms 7.93 ms -4.51%
⚪ btrfs/vscode/grep/grep_repo/plain_no_matches 105.16 ms 105.75 ms +0.56%
⚪ btrfs/vscode/grep/grep_repo/regex 19.00 ms 18.29 ms -3.73%
⚪ btrfs/vscode/grep/grep_repo/fuzzy_exact 11.82 ms 11.80 ms -0.15%
⚪ btrfs/vscode/grep/grep_repo/fuzzy_typo 11.89 ms 11.67 ms -1.88%
⚪ core/parse/realistic_queries/file 56 ns 56 ns +0.00%
⚪ core/parse/realistic_queries/test 56 ns 56 ns +0.00%
⚪ core/parse/realistic_queries/mod.rs 68 ns 68 ns +0.00%
⚪ core/parse/realistic_queries/src/*.rs 86 ns 87 ns +1.16%
⚪ core/parse/realistic_queries/lib_test 131 ns 130 ns -0.76%
⚪ core/parse/realistic_queries/*.rs_!test 149 ns 149 ns +0.00%
⚪ core/parse/realistic_queries/src/lib/*.rs 99 ns 99 ns +0.00%
⚪ core/parse/realistic_queries//src/_name 131 ns 132 ns +0.76%
⚪ core/parse/realistic_queries/status:modified_*.rs 175 ns 174 ns -0.57%
⚪ core/parse/realistic_queries/type:rust_test_!node_modules 286 ns 287 ns +0.35%
⚪ core/definition/definition/rust/mixed_256 7.34 µs 7.32 µs -0.27%
⚪ core/definition/definition/javascript/mixed_256 14.29 µs 14.40 µs +0.72%
⚪ core/definition/definition/python/mixed_256 5.45 µs 5.48 µs +0.50%
⚪ core/glob/glob_reuse_10k/recompile_each_time 99.62 µs 98.31 µs -1.31%
⚪ core/glob/glob_reuse_10k/reuse_compiled 98.32 µs 97.40 µs -0.94%
⚪ core/glob/glob_mixed_100k/prepass_bitmap/ext_1of10 1.23 ms 1.23 ms -0.30%
⚪ core/glob/glob_mixed_100k/inline_compiled/ext_1of10 296.18 µs 297.32 µs +0.39%
⚪ core/glob/glob_mixed_100k/prepass_bitmap/ext_4of10 1.58 ms 1.58 ms -0.05%
⚪ core/glob/glob_mixed_100k/inline_compiled/ext_4of10 842.23 µs 883.53 µs +4.90%
⚪ core/glob/glob_mixed_100k/prepass_bitmap/ext_8of10 1.88 ms 1.89 ms +0.21%
⚪ core/glob/glob_mixed_100k/inline_compiled/ext_8of10 1.41 ms 1.41 ms +0.27%
⚪ core/glob/glob_mixed_100k/prepass_bitmap/ext_all 1.96 ms 1.96 ms -0.02%
⚪ core/glob/glob_mixed_100k/inline_compiled/ext_all 1.63 ms 1.63 ms -0.13%
⚪ core/bigram/bigram_build/short_content/10000 6.64 ms 6.58 ms -0.95%
🟢 core/bigram/bigram_query_100000/long_14char 582 ns 327 ns -43.81%
🟢 core/bigram/bigram_query_100000/medium_6char 539 ns 286 ns -46.94%
🟢 core/bigram/bigram_query_100000/multi_word 560 ns 307 ns -45.18%
⚪ core/memmem/simd_string_utils_memmem/find/file_picker.rs/53KB/medium/miss 4.03 µs 4.07 µs +0.97%
⚪ core/memmem/simd_string_utils_memmem/find/file_picker.rs/53KB/long/miss 3.62 µs 3.62 µs +0.00%

🔗 Workflow run

@dkovalenko-oai
dkovalenko-oai force-pushed the perf/bound-frecency-pages branch from 36fda7b to 2fa8267 Compare November 10, 2026 15:20
dmtrKovalenko and others added 2 commits November 10, 2026 15:55
Keep the highest-ranked files from each chunk for small, early pages in large inventories. Count every live file and use the existing score comparison to preserve page order.
@dkovalenko-oai
dkovalenko-oai force-pushed the perf/bound-frecency-pages branch from 2fa8267 to 6814069 Compare November 10, 2026 23:55
@dkovalenko-oai
dkovalenko-oai merged commit 93b0d14 into main Nov 11, 2026
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code-reviewed Review completed; does not imply approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants