File: time_loop.rs

package info (click to toggle)
rust-tiny-bench 0.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 204 kB
  • sloc: makefile: 4
file content (11 lines) | stat: -rw-r--r-- 290 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
use tiny_bench::run_timed_from_iterator;

fn main() {
    let generator = 0..100;
    let mut spooky_calculation = 0;
    let results = run_timed_from_iterator(generator, |i| {
        spooky_calculation += i;
    });
    results.pretty_print();
    assert_eq!(4950, spooky_calculation);
}