Add profiling tools, examples

This commit is contained in:
Paul Hauner
2019-05-05 15:32:09 +10:00
parent fd5f914c3c
commit acf854f558
5 changed files with 81 additions and 19 deletions

View File

@@ -0,0 +1,16 @@
//! Encode and decode a list 10,000 times.
//!
//! Useful for `cargo flamegraph`.
use ssz::{Decodable, Encodable};
fn main() {
let vec: Vec<u64> = vec![4242; 8196];
let output: Vec<Vec<u64>> = (0..10_000)
.into_iter()
.map(|_| Vec::from_ssz_bytes(&vec.as_ssz_bytes()).unwrap())
.collect();
println!("{}", output.len());
}