Use iter_with_setup() to improve precision

This commit is contained in:
Greg Fitzgerald 2018-07-10 16:38:47 -06:00 committed by Greg Fitzgerald
parent cc89801b12
commit d2be79f38c
1 changed files with 11 additions and 7 deletions

View File

@ -39,13 +39,17 @@ fn bench_process_transaction(bencher: &mut Bencher) {
})
.collect();
bencher.iter(|| {
// Since benchmarker runs this multiple times, we need to clear the signatures.
bank.clear_signatures();
let results = bank.process_transactions(transactions.clone());
assert!(results.iter().all(Result::is_ok));
})
bencher.iter_with_setup(
|| {
// Since benchmarker runs this multiple times, we need to clear the signatures.
bank.clear_signatures();
transactions.clone()
},
|transactions| {
let results = bank.process_transactions(transactions);
assert!(results.iter().all(Result::is_ok));
},
)
}
fn bench(criterion: &mut Criterion) {