fn bench_get_seq_raw(c: &mut Criterion) {
    let n = 100;
    let (_dir, env) = setup_bench_db(n);

    let dbi = env.begin_ro_txn().unwrap().open_db(None).unwrap().dbi();
    let _txn = env.begin_ro_txn().unwrap();
    let txn = _txn.txn();

    let mut key = MDBX_val {
        iov_len: 0,
        iov_base: ptr::null_mut(),
    };
    let mut data = MDBX_val {
        iov_len: 0,
        iov_base: ptr::null_mut(),
    };
    let mut cursor: *mut MDBX_cursor = ptr::null_mut();

    c.bench_function("bench_get_seq_raw", |b| {
        b.iter(|| unsafe {
            mdbx_cursor_open(txn, dbi, &mut cursor);
            let mut i = 0;
            let mut count = 0u32;

            while mdbx_cursor_get(cursor, &mut key, &mut data, MDBX_NEXT) == 0 {
                i += key.iov_len + data.iov_len;
                count += 1;
            }

            black_box(i);
            assert_eq!(count, n);
            mdbx_cursor_close(cursor);
        })
    });
}
/// Benchmark of raw MDBX sequential read performance (control).
Benchmark of raw MDBX sequential read performance (control).
Benchmark of raw MDBX sequential read performance ( control ) .
fn bench_get_seq_raw(c: &mut Criterion) {
    let n = 100;
    let (_dir, env) = setup_bench_db(n);
    let dbi = env.begin_ro_txn().unwrap().open_db(None).unwrap().dbi();
    let _txn = env.begin_ro_txn().unwrap();
    let txn = _txn.txn();
    let mut key = MDBX_val {
        iov_len: 0,
        iov_base: ptr::null_mut(),
    };
    let mut data = MDBX_val {
        iov_len: 0,
        iov_base: ptr::null_mut(),
    };
    let mut cursor: *mut MDBX_cursor = ptr::null_mut();
    c.bench_function("bench_get_seq_raw", |b| {
        b.iter(|| unsafe {
            mdbx_cursor_open(txn, dbi, &mut cursor);
            let mut i = 0;
            let mut count = 0u32;
            while mdbx_cursor_get(cursor, &mut key, &mut data, MDBX_NEXT) == 0 {
                i += key.iov_len + data.iov_len;
                count += 1;
            }
            black_box(i);
            assert_eq!(count, n);
            mdbx_cursor_close(cursor);
        })
    });
}
fn bench_get_seq_raw ( c : & mut Criterion ) { let n = 100 ; let ( _dir , env ) = setup_bench_db ( n ) ; let dbi = env . begin_ro_txn ( ) . unwrap ( ) . open_db ( None ) . unwrap ( ) . dbi ( ) ; let _txn = env . begin_ro_txn ( ) . unwrap ( ) ; let txn = _txn . txn ( ) ; let mut key = MDBX_val { iov_len : 0 , iov_base : ptr :: null_mut ( ) , } ; let mut data = MDBX_val { iov_len : 0 , iov_base : ptr :: null_mut ( ) , } ; let mut cursor : * mut MDBX_cursor = ptr :: null_mut ( ) ; c . bench_function ( " " , | b | { b . iter ( | | unsafe { mdbx_cursor_open ( txn , dbi , & mut cursor ) ; let mut i = 0 ; let mut count = 0u32 ; while mdbx_cursor_get ( cursor , & mut key , & mut data , MDBX_NEXT ) == 0 { i += key . iov_len + data . iov_len ; count += 1 ; } black_box ( i ) ; assert_eq ! ( count n ) ; mdbx_cursor_close ( cursor ) ; } ) } ) ; }
Benchmark of raw MDBX sequential read performance (control).
Benchmark of raw MDBX sequential read performance ( control ) .
c
&mut Criterion