Debian Codegraph @

benches/lib.rs

raw symbols SCIP
1 #![feature(test)]
2
3 extern crate testrust-analyzer cargo md5 0.8.0 test/;
4
5 use md5rust-analyzer cargo md5 0.8.0 crate/::Contextrust-analyzer cargo md5 0.8.0 Context#;
6
7 macro_rules! implementrust-analyzer cargo md5 0.8.0 implement!(
8 ($($size:literal => ($compute:ident, $context:ident),)*) => ($(
9 #[bench]
10 fn $compute(bencher: &mut test::Bencher) {
11 compute($size, bencher);
12 }
13
14 #[bench]
15 fn $context(bencher: &mut test::Bencher) {
16 context($size, bencher);
17 }
18 )*);
19 );
20
21 implementrust-analyzer cargo md5 0.8.0 implement!! {
22 1000 => (compute_0001000rust-analyzer cargo md5 0.8.0 compute_0001000()., context_0001000rust-analyzer cargo md5 0.8.0 context_0001000().),
23 10000 => (compute_0010000rust-analyzer cargo md5 0.8.0 compute_0010000()., context_0010000rust-analyzer cargo md5 0.8.0 context_0010000().),
24 100000 => (compute_0100000rust-analyzer cargo md5 0.8.0 compute_0100000()., context_0100000rust-analyzer cargo md5 0.8.0 context_0100000().),
25 1000000 => (compute_1000000rust-analyzer cargo md5 0.8.0 compute_1000000()., context_1000000rust-analyzer cargo md5 0.8.0 context_1000000().),
26 }
27
28 fn computerust-analyzer cargo md5 0.8.0 compute().(size: usize, bencher: &mut testrust-analyzer cargo test https://github.com/rust-lang/rust/library/test crate/::Bencherrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/Bencher#) {
29 let data = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0xffu8; size];
30 bencher.iterrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/impl#[Bencher]iter().(|| {
31 testrust-analyzer cargo test https://github.com/rust-lang/rust/library/test crate/::black_boxrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/black_box().(md5rust-analyzer cargo md5 0.8.0 crate/::computerust-analyzer cargo md5 0.8.0 compute().(&data));
32 });
33 }
34
35 fn contextrust-analyzer cargo md5 0.8.0 context().(size: usize, bencher: &mut testrust-analyzer cargo test https://github.com/rust-lang/rust/library/test crate/::Bencherrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/Bencher#) {
36 let data = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0xffu8; size];
37 bencher.iterrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/impl#[Bencher]iter().(|| {
38 let mut context = Contextrust-analyzer cargo md5 0.8.0 Context#::newrust-analyzer cargo md5 0.8.0 impl#[Context]new().();
39 context.consumerust-analyzer cargo md5 0.8.0 impl#[Context]consume().(&data);
40 testrust-analyzer cargo test https://github.com/rust-lang/rust/library/test crate/::black_boxrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/black_box().(context.finalizerust-analyzer cargo md5 0.8.0 impl#[Context]finalize().());
41 });
42 }