fn bench_write_blobs(bench: &mut Bencher, blobs: &mut Vec<Blob>, ledger_path: &str) {
    let blocktree =
        Blocktree::open(&ledger_path).expect("Expected to be able to open database ledger");

    let num_blobs = blobs.len();

    bench.iter(move || {
        for blob in blobs.iter_mut() {
            let index = blob.index();

            blocktree
                .put_data_blob_bytes(
                    blob.slot(),
                    index,
                    &blob.data[..BLOB_HEADER_SIZE + blob.size()],
                )
                .unwrap();

            blob.set_index(index + num_blobs as u64);
        }
    });

    Blocktree::destroy(&ledger_path).expect("Expected successful database destruction");
}
// Given some blobs and a ledger at ledger_path, benchmark writing the blobs to the ledger
Given some blobs and a ledger at ledger_path, benchmark writing the blobs to the ledger
Given some blobs and a ledger at ledger_path benchmark writing the blobs to the ledger
fn bench_write_blobs(bench: &mut Bencher, blobs: &mut Vec<Blob>, ledger_path: &str) {
    let blocktree =
        Blocktree::open(&ledger_path).expect("Expected to be able to open database ledger");
    let num_blobs = blobs.len();
    bench.iter(move || {
        for blob in blobs.iter_mut() {
            let index = blob.index();
            blocktree
                .put_data_blob_bytes(
                    blob.slot(),
                    index,
                    &blob.data[..BLOB_HEADER_SIZE + blob.size()],
                )
                .unwrap();
            blob.set_index(index + num_blobs as u64);
        }
    });
    Blocktree::destroy(&ledger_path).expect("Expected successful database destruction");
}
fn bench_write_blobs ( bench : & mut Bencher , blobs : & mut Vec < Blob > , ledger_path : & str ) { let blocktree = Blocktree :: open ( & ledger_path ) . expect ( " " ) ; let num_blobs = blobs . len ( ) ; bench . iter ( move | | { for blob in blobs . iter_mut ( ) { let index = blob . index ( ) ; blocktree . put_data_blob_bytes ( blob . slot ( ) , index , & blob . data [ .. BLOB_HEADER_SIZE + blob . size ( ) ] , ) . unwrap ( ) ; blob . set_index ( index + num_blobs as u64 ) ; } } ) ; Blocktree :: destroy ( & ledger_path ) . expect ( " " ) ; }
Given some blobs and a ledger at ledger_path, benchmark writing the blobs to the ledger
Given some blobs and a ledger at ledger_path benchmark writing the blobs to the ledger
bench
&mut Bencher
blobs
&mut Vec<Blob>
ledger_path
&str
bench
&mut Bencher
blobs
&mut Vec<Blob>
ledger_path
&str