Skip to content

Commit

Permalink
Merge pull request #6 from Vurich/master
Browse files Browse the repository at this point in the history
Speed up bigint impl
  • Loading branch information
NikVolf authored Mar 26, 2018
2 parents 964b48f + ffbf39b commit 786c0d5
Show file tree
Hide file tree
Showing 12 changed files with 1,017 additions and 460 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ name = "api"
rand = "0.4"
rustc-serialize = { version = "0.3", optional = true }
byteorder = "1.0"
crunchy = "0.2.1"

[dev-dependencies.bincode]
version = "0.6"
Expand Down
22 changes: 10 additions & 12 deletions benches/api.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#![feature(test)]
extern crate test;
extern crate rand;
extern crate bn;
extern crate bincode;
extern crate bn;
extern crate rand;
extern crate test;

use bn::*;
use bincode::SizeLimit::Infinite;
use bincode::rustc_serialize::{encode, decode};
use bincode::rustc_serialize::{decode, encode};

const SAMPLES: usize = 30;

Expand All @@ -17,17 +17,15 @@ macro_rules! benchmark(
let $rng = &mut rand::thread_rng();
let $input: Vec<_> = (0..SAMPLES).map(|_| $pre).collect();

b.bench_n(SAMPLES as u64, |b| {
let mut c = 0;
let mut c = 0;

b.iter(|| {
c += 1;
b.iter(|| {
c += 1;

let $input = &$input[c % SAMPLES];
let $input = &$input[c % SAMPLES];

$post
})
})
$post
});
}
)
);
Expand Down
Loading

0 comments on commit 786c0d5

Please sign in to comment.