Expand bigint shl/shr benchmarking

This commit is contained in:
Josh Stone 2016-01-27 22:53:10 -08:00
parent 494fce7dd3
commit 1ebcc77513
1 changed files with 15 additions and 4 deletions

View File

@ -168,12 +168,23 @@ fn from_str_radix_36(b: &mut Bencher) {
} }
#[bench] #[bench]
fn shr(b: &mut Bencher) { fn shl(b: &mut Bencher) {
let n = { let one : BigUint = One::one(); one << 1000 }; let n = BigUint::one() << 1000;
b.iter(|| { b.iter(|| {
let mut m = n.clone(); let mut m = n.clone();
for _ in 0..10 { for i in 0..50 {
m = m >> 1; m = m << i;
}
})
}
#[bench]
fn shr(b: &mut Bencher) {
let n = BigUint::one() << 2000;
b.iter(|| {
let mut m = n.clone();
for i in 0..50 {
m = m >> i;
} }
}) })
} }