Crate bencher [−] [src]
Simplified stable-compatible benchmark runner.
Almost all user code will only be interested in Bencher
and the
macros that are used to describe benchmarker functions and
the benchmark runner.
WARNING: There's no working black_box yet in this stable port of the benchmark runner. This means that it easily happens that the optimizer removes too much of the computation that you tried to benchmark.
One way to use this crate is to use it as dev-dependency and define
the benchmarks in an example that you compile and run using cargo. Don't forget
to use --release
!.
#[macro_use] extern crate bencher; use bencher::Bencher; fn a(bench: &mut Bencher) { bench.iter(|| { (0..1000).fold(0, |x, y| x + y) }) } fn b(bench: &mut Bencher) { bench.iter(|| { String::new() }) } benchmark_group!(benches, a, b); benchmark_main!(benches);
Reexports
pub use self::TestFn::*; |
Modules
bench | |
stats |
Macros
benchmark_group! |
Defines a function called |
benchmark_main! |
Define a |
Structs
BenchSamples | |
Bencher |
Manager of the benchmarking runs. |
TestDesc | |
TestDescAndFn | |
TestOpts | |
TestPaths |
Enums
TestFn |
Traits
TDynBenchFn |
Represents a benchmark function. |
Functions
fmt_bench_samples | |
run_tests_console |
Type Definitions
TestName |