mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-29 02:33:48 +00:00
Add profiling tools, examples
This commit is contained in:
16
eth2/utils/ssz/examples/large_list.rs
Normal file
16
eth2/utils/ssz/examples/large_list.rs
Normal 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());
|
||||
}
|
||||
Reference in New Issue
Block a user