additional benches for rlp

This commit is contained in:
debris 2018-08-23 13:54:07 +02:00
parent 0257de35c5
commit b34012c945
1 changed files with 15 additions and 0 deletions

View File

@ -101,3 +101,18 @@ fn bench_stream_1000_empty_lists(b: &mut Bencher) {
let _ = stream.out();
});
}
#[bench]
fn bench_decode_1000_values(b: &mut Bencher) {
let mut stream = RlpStream::new_list(1000);
for _ in 0..1000 {
stream.append(&U256::from(1));
}
let data= stream.out();
b.iter(|| {
let rlp = Rlp::new(&data);
for i in 0..1000 {
let _: U256 = rlp.val_at(i).unwrap();
}
});
}