Crates.io | iai-callgrind |
lib.rs | iai-callgrind |
version | 0.16.1 |
created_at | 2023-03-08 22:06:27.685048+00 |
updated_at | 2025-07-30 07:20:32.661683+00 |
description | High-precision and consistent benchmarking framework/harness for Rust |
homepage | https://github.com/iai-callgrind/iai-callgrind |
repository | https://github.com/iai-callgrind/iai-callgrind |
max_upload_size | |
id | 805163 |
size | 566,415 |
Iai-Callgrind is a benchmarking framework/harness which uses Valgrind's Callgrind and other Valgrind tools like DHAT, Massif, ... including Cachegrind to provide extremely accurate and consistent measurements of Rust code, making it perfectly suited to run in environments like a CI. Iai-Callgrind is integrated in Bencher.
Iai-Callgrind is:
Instruction
counts and many
other metrics allow you to reliably detect very small optimizations and
regressions of your code.dh_view.html
and
others to analyze the results in detail are fully supported.See the Guide and api documentation at docs.rs for all the details.
To get started read the Guide and see some introductory examples in Quickstart for library benchmarks or Quickstart for binary benchmarks
Iai-Callgrind benchmarks are designed to be runnable with cargo bench
. The
benchmark files are expanded to a benchmarking harness which replaces the native
benchmark harness of rust
. Iai-Callgrind is a profiling framework that can
quickly and reliably detect performance regressions and optimizations even in
noisy environments with a precision that is impossible to achieve with
wall-clock time based benchmarks. At the same time, we want to abstract the
complicated parts and repetitive tasks away and provide an easy to use and
intuitive api. Iai-Callgrind tries to stay out of your way and applies sensible
default settings so you can focus more on profiling and your code!
Iai-Callgrind is in a mature development stage and is already in
use.
Nevertheless, you may experience big changes between a minor version bump. With
the release of 0.14.0
, almost all Callgrind
capabilities are implemented
including benchmarking of multi-threaded and multi-process applications. Using
Cachegrind
instead of or in addition to Callgrind
is possible since
0.15.0
. Profiling of heap usage with DHAT
is fully integrated since
0.16.0
. Profiling with Massif
is possible, but doesn't show useful metrics
in the terminal output and can be further improved. Creating callgrind
flamegraphs for multi-process/multi-threaded benchmarks is considered to be in
an experimental state. Please read our Vision to learn more about
the ideas and the direction the future path might take.
Although Iai-Callgrind is useful in many projects, there are cases where Iai-Callgrind is not a good fit.
Thanks for helping to improve this project! A guideline about contributing to Iai-Callgrind can be found in the CONTRIBUTING.md file.
You have an idea for a new feature, are missing a functionality or have found a bug?
Please don't hesitate to open an issue.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as in License, without any additional terms or conditions.
Iai-Callgrind is forked from https://github.com/bheisler/iai and the original idea is from Brook Heisler (@bheisler).
Iai-Callgrind is powered by Valgrind.
Iai-Callgrind is like Iai dual licensed under the Apache 2.0 license and the MIT license at your option.
According to Valgrind's documentation:
The Valgrind headers, unlike most of the rest of the code, are under a BSD-style license, so you may include them without worrying about license incompatibility.
We have included the original license where we made use of the original header files.