4.6. Benchmarking¶
The library provides a benchmark of the worst case AI update time allowing
users of the library to evaluate if the library fits in with their performance
goals. Cargo contains built in benchmark support: any tests that have the
bench
attribute are exercised by running cargo bench
. 1
Listing 4.4 shows an example of benchmarking the worst
case AI move.
#[bench]
fn worst_case_ai_move_benchmark(b: &mut Bencher) {
let game = Game::new();
let mistake_probability = 0.0;
b.iter(|| AIMove::new(game, mistake_probability));
}
The worst case update time is for a new game and a zero percent mistake probability. Under this situation the Artificial Intelligence Algorithms have to evaluate the entire problem space.
The library’s source code repository README.md
file contains instructions on
how to run the benchmarks.
Related Requirements
Footnotes
- 1
See Benchmark tests for details.