fn smt_root_hash(b: &mut Bencher<'_>) {
    let depth = models::params::account_tree_depth();
    let accounts: Vec<_> = (0..N_ACCOUNTS).map(gen_account).collect();

    // Create a tree and fill it with some accounts.
    let mut tree = RealSMT::new(depth);
    for (id, account) in accounts.into_iter().enumerate() {
        tree.insert(id, account.clone())
    }

    let setup = || (tree.clone());

    b.iter_batched(
        setup,
        |tree| {
            let _hash = black_box(tree.root_hash());
        },
        BatchSize::SmallInput,
    );
}
/// Measures the time of obtaining a SMT root hash.
Measures the time of obtaining a SMT root hash.
Measures the time of obtaining a SMT root hash .
fn smt_root_hash(b: &mut Bencher<'_>) {
    let depth = models::params::account_tree_depth();
    let accounts: Vec<_> = (0..N_ACCOUNTS).map(gen_account).collect();
    // Create a tree and fill it with some accounts.
    let mut tree = RealSMT::new(depth);
    for (id, account) in accounts.into_iter().enumerate() {
        tree.insert(id, account.clone())
    }
    let setup = || (tree.clone());
    b.iter_batched(
        setup,
        |tree| {
            let _hash = black_box(tree.root_hash());
        },
        BatchSize::SmallInput,
    );
}
fn smt_root_hash ( b : & mut Bencher < ' _ > ) { let depth = models :: params :: account_tree_depth ( ) ; let accounts : Vec < _ > = ( 0 .. N_ACCOUNTS ) . map ( gen_account ) . collect ( ) ; // Create a tree and fill it with some accounts. let mut tree = RealSMT :: new ( depth ) ; for ( id , account ) in accounts . into_iter ( ) . enumerate ( ) { tree . insert ( id , account . clone ( ) ) } let setup = | | ( tree . clone ( ) ) ; b . iter_batched ( setup , | tree | { let _hash = black_box ( tree . root_hash ( ) ) ; } , BatchSize :: SmallInput , ) ; }
Measures the time of obtaining a SMT root hash.
Measures the time of obtaining a SMT root hash .
b
&mut Bencher<'_>