Guide
A guide is being worked on. In the meantime, see announcement post.
Getting Started
-
Add the following to your project's
Cargo.toml
:[] = "0.1.3" [[]] = "example" = false
-
Create a benchmarks file at
benches/example.rs
[^1] with your benchmarking code:// Define a `fibonacci` function and register it for benchmarking.
-
Run your benchmarks with
cargo bench
:example fastest │ slowest │ median │ mean │ samples │ iters ╰─ fibonacci 196.1 ns │ 217 ns │ 197.5 ns │ 198.1 ns │ 100 │ 3200
See #[divan::bench]
for info on benchmark function registration.
Examples
Practical example benchmarks can be found in the examples/benches
directory. These can be benchmarked locally by running:
More thorough usage examples can be found in the #[divan::bench]
documentation.
License
Like the Rust project, this library may be used under either the MIT License or Apache License (Version 2.0).
[^1]: Within your crate directory, i.e. $CARGO_MANIFEST_DIR