You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rust-rocksdb/src/main.rs

31 lines
567 B

extern crate rocksdb;
extern crate test;
use rocksdb::open;
use test::Bencher;
fn main() {
println!("test");
}
#[bench]
fn writes(b: &mut Bencher) {
let db = open("testdb".to_string(), true).unwrap();
let mut i = 0 as u64;
b.iter(|| {
db.put(i.to_string().as_bytes(), b"v1111");
i += 1;
});
db.close();
}
#[bench]
fn reads(b: &mut Bencher) {
let db = open("testdb".to_string(), true).unwrap();
let mut i = 0 as u64;
b.iter(|| {
db.get(i.to_string().as_bytes());
i += 1;
});
db.close();
}