File: lib.rs

package info (click to toggle)
rust-md5 0.7.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 112 kB
  • sloc: makefile: 4
file content (16 lines) | stat: -rw-r--r-- 582 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#![feature(test)]

extern crate md5;
extern crate test;

#[bench] fn compute_0001000(bencher: &mut test::Bencher) { compute(   1000, bencher); }
#[bench] fn compute_0010000(bencher: &mut test::Bencher) { compute(  10000, bencher); }
#[bench] fn compute_0100000(bencher: &mut test::Bencher) { compute( 100000, bencher); }
#[bench] fn compute_1000000(bencher: &mut test::Bencher) { compute(1000000, bencher); }

fn compute(size: usize, bencher: &mut test::Bencher) {
    let data = &vec![0xffu8; size][..];
    bencher.iter(|| {
        test::black_box(md5::compute(data));
    });
}