Expand description
tiny-bench
, a tiny benchmarking library.
The crate is divided into two sections, benchmarking and timing.
Benchmarking provides tools to measure code execution, show statistics about that execution,
and compare those statistics to previous runs.
Timing provides tools to time code. Timing how long a closure runs, or how long an iterator runs.
Structs§
- Benchmark
Config - Struct containing all of the configuration options for a benchmark.
- Timed
Iterator - An iterator that wraps another iterator and times each call to
next
- Timing
Data - Data collected after a timed run
Traits§
- Timeable
- A trait for allowing iterators to be used as timers
Functions§
- bench
- Will run the closure and print statistics from the benchmarking to stdout. Will persist results under the anonymous label which is shared, making comparisons impossible if running more than one (different) benchmark on the same project, ie. benching two different functions
- bench_
labeled - Will run the closure with a label, running with a label enables comparisons for subsequent runs.
- bench_
with_ configuration - Will run the benchmark with the supplied configuration
- bench_
with_ configuration_ labeled - Will run the benchmark with the supplied configuration and a label
- bench_
with_ setup - Fitting if some setup for the benchmark is required, and that setup should not be timed. The setup will be run prior to each benchmarking run.
- bench_
with_ setup_ configuration - Run bench with setup and configuration
- bench_
with_ setup_ configuration_ labeled - Run bench with setup, configuration, and a label
- bench_
with_ setup_ labeled - Run bench with setup and a label
- black_
box - An identity function that hints to the compiler to be maximally pessimistic about what
black_box
could do. - run_
timed - The simplest possible timed function that just runs some
FnMut
closure and returns the time it took - run_
timed_ from_ iterator - Drains an iterator and calls the closure with the yielded value, timing the closure’s execution.
- run_
timed_ times - Runs some closure
n
times and returns the data gathered