d5f207424b
e2e Tests / e2e (macos-latest) (push) Waiting to run
Nix CI / check (push) Waiting to run
Python CI / Python bindings (macos-latest) (push) Waiting to run
e2e Tests / e2e (windows-latest) (push) Waiting to run
Python CI / Python bindings (windows-latest) (push) Waiting to run
Build & Publish / Build Neovim aarch64-apple-darwin (push) Waiting to run
Build & Publish / Build Neovim aarch64-pc-windows-msvc (push) Waiting to run
Build & Publish / Build Neovim x86_64-apple-darwin (push) Waiting to run
Build & Publish / Build Neovim x86_64-pc-windows-msvc (push) Waiting to run
Build & Publish / Build C FFI aarch64-apple-darwin (push) Waiting to run
Build & Publish / Build C FFI aarch64-pc-windows-msvc (push) Waiting to run
Build & Publish / Build C FFI x86_64-apple-darwin (push) Waiting to run
Build & Publish / Build C FFI x86_64-pc-windows-msvc (push) Waiting to run
Build & Publish / Build MCP aarch64-apple-darwin (push) Waiting to run
Build & Publish / Build MCP aarch64-pc-windows-msvc (push) Waiting to run
Build & Publish / Build MCP x86_64-apple-darwin (push) Waiting to run
Build & Publish / Build MCP x86_64-pc-windows-msvc (push) Waiting to run
Build & Publish / Build Python wheels aarch64 (macos-latest) (push) Waiting to run
Build & Publish / Build Python wheels x86_64 (macos-latest) (push) Waiting to run
Build & Publish / Build Python wheels x86_64 (windows-latest) (push) Waiting to run
Build & Publish / Release (push) Blocked by required conditions
Build & Publish / Publish Python wheels to PyPI (push) Blocked by required conditions
Build & Publish / Publish Rust crates (push) Blocked by required conditions
Build & Publish / Publish npm packages (push) Blocked by required conditions
Rust CI / Fuzz Tests (windows-latest) (push) Waiting to run
Rust CI / Test (macos-latest) (push) Waiting to run
Rust CI / Test (windows-latest) (push) Waiting to run
Rust CI / Fuzz Tests (macos-latest) (push) Waiting to run
Python CI / Python bindings (ubuntu-latest) (push) Failing after 0s
Build & Publish / Build Neovim aarch64-linux-android (push) Failing after 0s
Build & Publish / Build Neovim aarch64-unknown-linux-gnu (push) Failing after 0s
Build & Publish / Build MCP x86_64-unknown-linux-musl (push) Failing after 1s
Build & Publish / Build Python wheels aarch64 (ubuntu-latest) (push) Failing after 0s
Build & Publish / Build Python wheels x86_64 (ubuntu-latest) (push) Failing after 1s
Build & Publish / Build Python sdist (push) Failing after 1s
Rust CI / Fuzz Tests (ubuntu-latest) (push) Failing after 1s
Rust CI / Build i686-unknown-linux-gnu (push) Failing after 0s
Rust CI / cargo clippy (push) Failing after 1s
e2e Tests / e2e (ubuntu-latest) (push) Failing after 1s
Lua CI / luacheck lint (push) Failing after 1s
Build & Publish / Build Neovim aarch64-unknown-linux-musl (push) Failing after 1s
Build & Publish / Build Neovim x86_64-unknown-linux-gnu (push) Failing after 0s
Build & Publish / Build Neovim x86_64-unknown-linux-musl (push) Failing after 1s
Build & Publish / Build C FFI aarch64-linux-android (push) Failing after 0s
Build & Publish / Build C FFI aarch64-unknown-linux-gnu (push) Failing after 0s
Build & Publish / Build C FFI aarch64-unknown-linux-musl (push) Failing after 1s
Build & Publish / Build C FFI x86_64-unknown-linux-gnu (push) Failing after 0s
Build & Publish / Build C FFI x86_64-unknown-linux-musl (push) Failing after 1s
Build & Publish / Build MCP aarch64-unknown-linux-gnu (push) Failing after 1s
Build & Publish / Build MCP aarch64-unknown-linux-musl (push) Failing after 0s
Build & Publish / Build MCP x86_64-unknown-linux-gnu (push) Failing after 1s
Spelling / Spell Check with Typos (push) Failing after 0s
Rust CI / Test (ubuntu-latest) (push) Failing after 0s
Rust CI / cargo fmt (push) Failing after 0s
Stylua / Check lua files using Stylua (push) Failing after 1s
Lua CI / lua-language-server type check (push) Failing after 12m29s
e2e Tests / e2e (alpine-musl) (push) Successful in 57m31s
86 lines
3.0 KiB
Rust
86 lines
3.0 KiB
Rust
use criterion::{BenchmarkId, Criterion, black_box, criterion_group, criterion_main};
|
|
use fff_search::simd_string_utils::memmem;
|
|
use std::path::Path;
|
|
|
|
/// Load real source files from the repository as benchmark haystacks.
|
|
/// Falls back to concatenating all .rs files under crates/ if specific files are missing.
|
|
fn load_real_files() -> Vec<(&'static str, Vec<u8>)> {
|
|
let manifest_dir = env!("CARGO_MANIFEST_DIR"); // crates/fff-core
|
|
let repo_root = Path::new(manifest_dir).parent().unwrap().parent().unwrap();
|
|
|
|
let files: &[(&str, &str)] = &[
|
|
("grep.rs/80KB", "crates/fff-core/src/grep.rs"),
|
|
("file_picker.rs/53KB", "crates/fff-core/src/file_picker.rs"),
|
|
("picker_ui.lua/96KB", "lua/fff/picker_ui.lua"),
|
|
];
|
|
|
|
let mut result = Vec::new();
|
|
for &(label, rel_path) in files {
|
|
let full_path = repo_root.join(rel_path);
|
|
if let Ok(data) = std::fs::read(&full_path) {
|
|
result.push((label, data));
|
|
}
|
|
}
|
|
|
|
// Also create a large synthetic file by concatenating all three
|
|
if result.len() == 3 {
|
|
let mut combined = Vec::new();
|
|
for (_, data) in &result {
|
|
combined.extend_from_slice(data);
|
|
}
|
|
// Repeat to get ~1MB
|
|
let base = combined.clone();
|
|
while combined.len() < 1024 * 1024 {
|
|
combined.extend_from_slice(&base);
|
|
}
|
|
combined.truncate(1024 * 1024);
|
|
result.push(("combined/1MB", combined));
|
|
}
|
|
|
|
result
|
|
}
|
|
|
|
fn bench_memmem(c: &mut Criterion) {
|
|
let mut group = c.benchmark_group("simd_string_utils_memmem");
|
|
|
|
let files = load_real_files();
|
|
assert!(!files.is_empty(), "No source files found for benchmarking");
|
|
|
|
// Needles chosen to exercise different false-positive rates:
|
|
//
|
|
// "hit" needles: strings that actually appear in these source files.
|
|
// "miss" needles: strings with common first-bytes (lots of false positives
|
|
// for memchr2) but that don't exist in any of the files.
|
|
let needles: &[(&str, &[u8])] = &[
|
|
// Hits — real identifiers from the codebase
|
|
("short/hit/fn", b"fn"),
|
|
("short/hit/self", b"self"),
|
|
("medium/hit", b"search_file"),
|
|
("long/hit", b"content_cache_budget"),
|
|
// Misses — common first-bytes, guaranteed not in source
|
|
("short/miss", b"zqxjv"),
|
|
("medium/miss", b"fluxcapacitor"),
|
|
("long/miss", b"quantum_entanglement_resolver"),
|
|
];
|
|
|
|
for (file_label, haystack) in &files {
|
|
for &(needle_label, needle) in needles {
|
|
let needle_lower: Vec<u8> = needle.iter().map(|b| b.to_ascii_lowercase()).collect();
|
|
let id = format!("{file_label}/{needle_label}");
|
|
|
|
group.bench_with_input(
|
|
BenchmarkId::new("find", &id),
|
|
&(haystack, &needle_lower),
|
|
|b, &(h, n)| {
|
|
b.iter(|| black_box(memmem::find(h, n)));
|
|
},
|
|
);
|
|
}
|
|
}
|
|
|
|
group.finish();
|
|
}
|
|
|
|
criterion_group!(benches, bench_memmem);
|
|
criterion_main!(benches);
|