Skip to content

Commit d4b9d16

Browse files
committed
perf: -256kb RAM consumption for persistent index
1 parent 094a35e commit d4b9d16

File tree

14 files changed

+534
-603
lines changed

14 files changed

+534
-603
lines changed

crates/fff-core/benches/bigram_bench.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use criterion::{BenchmarkId, Criterion, black_box, criterion_group, criterion_main};
2-
use fff_search::types::{BigramFilter, BigramIndexBuilder};
2+
use fff_search::bigram_filter::{BigramFilter, BigramIndexBuilder};
33

44
/// Build a realistic bigram index for benchmarking.
55
/// Simulates a large repo by generating varied content per file.
@@ -53,7 +53,14 @@ fn bench_bigram_query(c: &mut Criterion) {
5353

5454
fn bench_bigram_is_candidate(c: &mut Criterion) {
5555
let index = build_test_index(500_000);
56-
let candidates = index.query(b"struct").unwrap();
56+
let candidates = match index.query(b"struct") {
57+
Some(c) => c,
58+
None => {
59+
// All bigrams ubiquitous at this size — skip candidate benches
60+
eprintln!("Skipping is_candidate bench: query returned None (all bigrams ubiquitous)");
61+
return;
62+
}
63+
};
5764

5865
c.bench_function("is_candidate_500k", |b| {
5966
b.iter(|| {

0 commit comments

Comments
 (0)