Skip to content

Commit

Permalink
add bench setup + bump max input size for fuzzing
Browse files Browse the repository at this point in the history
  • Loading branch information
glendc committed Apr 9, 2024
1 parent 34cc1f4 commit 58afd25
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -344,4 +344,4 @@ jobs:
cargo install cargo-fuzz
- name: cargo fuzz check
run: |
cargo fuzz run fuzz_employee_db -- -max_total_time=30
cargo fuzz run fuzz_employee_db -- -max_len=131072 -max_total_time=30
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,9 @@ rand = "0.8.5"
venndb-macros = { version = "0.1.0", path = "venndb-macros" }

[dev-dependencies]
divan = "0.1.14"
itertools = "0.12.1"

[[bench]]
name = "proxydb"
harness = false
14 changes: 14 additions & 0 deletions benches/proxydb.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
fn main() {
// Run registered benchmarks.
divan::main();
}

// Register a `fibonacci` function and benchmark it over multiple cases.
#[divan::bench(args = [1, 2, 4, 8, 16, 32])]
fn fibonacci(n: u64) -> u64 {
if n <= 1 {
1
} else {
fibonacci(n - 2) + fibonacci(n - 1)
}
}
7 changes: 5 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ watch-check:
cargo watch -x check -x test

fuzz:
cargo +nightly fuzz run fuzz_employee_db
cargo +nightly fuzz run fuzz_employee_db -- -max_len=131072

fuzz-30s:
cargo +nightly fuzz run fuzz_employee_db -- -max_total_time=60
cargo +nightly fuzz run fuzz_employee_db -- -max_len=131072 -max_total_time=60

bench:
cargo bench

0 comments on commit 58afd25

Please sign in to comment.