Calliper is a Callgrind-based benchmarking harness with few-too-many knobs sticking out.
State: There's still a lot to do, but Calliper should be usable now. Note that I plan to break API prior to 1.0.0 arbitrarily in minor versions.
To use Calliper, you must have Valgrind installed.
To write your first benchmark with Calliper, add the following to your Cargo.toml
:
```toml
[dev-dependencies]
calliper = "0.1.4"
[[bench]] name = "myfirstcalliper_benchmark" harness = false ```
Then, create a file at $PROJECT/benches/my_first_calliper_benchmark.rs
with the following contents:
```rust use calliper::utils::black_box; use calliper::{Runner, Scenario};
fn binarysearchimpl(haystack: &[u8], needle: u8) -> Result
fn linearsearchimpl(haystack: &[u8], needle: u8) -> Option
fn benchlinearsearch() {
let range = (0..255).collect::
fn main() -> Result<(), Box
Now the benchmark can be executed with cargo bench
.
More sophisticated examples can be found in benches folder of this repository.
This project is licensed under either of
at your option.
Calliper is inspired by Iai benchmarking harness.