| Vulnerabilities | |||||
|---|---|---|---|---|---|
| Version | Suggest | Low | Medium | High | Critical |
| 0.1.21 | 0 | 0 | 0 | 0 | 0 |
| 0.1.20 | 0 | 0 | 0 | 0 | 0 |
| 0.1.19 | 0 | 0 | 0 | 0 | 0 |
| 0.1.18 | 0 | 0 | 0 | 0 | 0 |
| 0.1.17 | 0 | 0 | 0 | 0 | 0 |
| 0.1.16 | 0 | 0 | 0 | 0 | 0 |
| 0.1.15 | 0 | 0 | 0 | 0 | 0 |
| 0.1.14 | 0 | 0 | 0 | 0 | 0 |
| 0.1.13 | 0 | 0 | 0 | 0 | 0 |
| 0.1.12 | 0 | 0 | 0 | 0 | 0 |
| 0.1.11 | 0 | 0 | 0 | 0 | 0 |
| 0.1.10 | 0 | 0 | 0 | 0 | 0 |
| 0.1.9 | 0 | 0 | 0 | 0 | 0 |
| 0.1.8 | 0 | 0 | 0 | 0 | 0 |
| 0.1.7 | 0 | 0 | 0 | 0 | 0 |
| 0.1.6 | 0 | 0 | 0 | 0 | 0 |
| 0.1.5 | 0 | 0 | 0 | 0 | 0 |
| 0.1.4 | 0 | 0 | 0 | 0 | 0 |
| 0.1.3 | 0 | 0 | 0 | 0 | 0 |
| 0.1.2 | 0 | 0 | 0 | 0 | 0 |
| 0.1.1 | 0 | 0 | 0 | 0 | 0 |
| 0.1.0 | 0 | 0 | 0 | 0 | 0 |
| 0.0.0 | 0 | 0 | 0 | 0 | 0 |
0.1.21 - This version may not be safe as it has not been updated for a long time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform
Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.
MIT - MIT LicenseIf you or your company find Divan valuable, consider sponsoring on GitHub or donating via PayPal. Sponsorships help me progress on what's possible with benchmarking in Rust.
A guide is being worked on. In the meantime, see:
Divan 0.1.21 requires Rust 1.80.0 or later.
Add the following to your project's Cargo.toml:
[dev-dependencies]
divan = "0.1.21"
[[bench]]
name = "example"
harness = falseCreate a benchmarks file at benches/example.rs1 with your benchmarking code:
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)
}
}Run your benchmarks with cargo bench:
example fastest │ slowest │ median │ mean │ samples │ iters
╰─ fibonacci │ │ │ │ │
├─ 1 0.626 ns │ 1.735 ns │ 0.657 ns │ 0.672 ns │ 100 │ 819200
├─ 2 2.767 ns │ 3.154 ns │ 2.788 ns │ 2.851 ns │ 100 │ 204800
├─ 4 6.816 ns │ 7.671 ns │ 7.061 ns │ 7.167 ns │ 100 │ 102400
├─ 8 57.31 ns │ 62.51 ns │ 57.96 ns │ 58.55 ns │ 100 │ 12800
├─ 16 2.874 µs │ 3.812 µs │ 2.916 µs │ 3.006 µs │ 100 │ 200
╰─ 32 6.267 ms │ 6.954 ms │ 6.283 ms │ 6.344 ms │ 100 │ 100See #[divan::bench] for info on benchmark function registration.
Practical example benchmarks can be found in the examples/benches
directory. These can be benchmarked locally by running:
git clone https://github.com/nvzqz/divan.git
cd divan
cargo bench -q -p examples --all-featuresMore thorough usage examples can be found in the #[divan::bench] documentation.
Like the Rust project, this library may be used under either the MIT License or Apache License (Version 2.0).
Within your crate directory, i.e. $CARGO_MANIFEST_DIR ↩