sub x64 optimize

This commit is contained in:
Nikolay Volf
2016-02-24 23:08:21 +03:00
parent 476bb85d41
commit 7821505139
2 changed files with 52 additions and 8 deletions

View File

@@ -29,9 +29,18 @@ use test::{Bencher, black_box};
use ethcore_util::uint::*;
#[bench]
fn u256_first_degree(b: &mut test::Bencher) {
fn u256_add(b: &mut Bencher) {
b.iter(|| {
let n = black_box(10000);
(0..n).fold(U256::zero(), |old, new| { old.overflowing_add(U256::from(new)).0 })
});
}
#[bench]
fn u256_sub(b: &mut Bencher) {
b.iter(|| {
let n = black_box(10000);
(0..n).fold(U256::zero(), |old, new| { old.overflowing_add(U256::from(new)).0 })
});
}