Skip to content

Commit 9c30eda

Browse files
feat: Expand internal SIMD memmem implemenation and use it everywhere (#666)
Drop the custom ad-hoc implemenations per feature and memchar::Finder when we can use internal optimize case flip & memmem
1 parent 1a8ef35 commit 9c30eda

12 files changed

Lines changed: 831 additions & 1229 deletions

File tree

crates/fff-core/benches/memmem_bench.rs

Lines changed: 4 additions & 12 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::case_insensitive_memmem;
2+
use fff_search::simd_string_utils::memmem;
33
use std::path::Path;
44

55
/// Load real source files from the repository as benchmark haystacks.
@@ -41,7 +41,7 @@ fn load_real_files() -> Vec<(&'static str, Vec<u8>)> {
4141
}
4242

4343
fn bench_memmem(c: &mut Criterion) {
44-
let mut group = c.benchmark_group("case_insensitive_memmem");
44+
let mut group = c.benchmark_group("simd_string_utils_memmem");
4545

4646
let files = load_real_files();
4747
assert!(!files.is_empty(), "No source files found for benchmarking");
@@ -69,18 +69,10 @@ fn bench_memmem(c: &mut Criterion) {
6969
let id = format!("{file_label}/{needle_label}");
7070

7171
group.bench_with_input(
72-
BenchmarkId::new("packed_pair", &id),
72+
BenchmarkId::new("find", &id),
7373
&(haystack, &needle_lower),
7474
|b, &(h, n)| {
75-
b.iter(|| black_box(case_insensitive_memmem::search_packed_pair(h, n)));
76-
},
77-
);
78-
79-
group.bench_with_input(
80-
BenchmarkId::new("memchr2_search", &id),
81-
&(haystack, &needle_lower),
82-
|b, &(h, n)| {
83-
b.iter(|| black_box(case_insensitive_memmem::search(h, n)));
75+
b.iter(|| black_box(memmem::find(h, n)));
8476
},
8577
);
8678
}

0 commit comments

Comments
 (0)