Mercurial > lbo > hg > leveldb-rs
view src/env_common.rs @ 433:9d8aae30be98
cmp: Make memtable key comparisons ~4x faster.
Similar to the internal key comparison improvement: Only parse expensive
FixedInts when required.
This change brings rusty-leveldb within 10% of the original for write-heavy
workloads and 25% for iterating workloads.
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Sun, 22 Oct 2017 09:42:19 +0200 |
parents | d7e4693effba |
children | 9f01a2fbcda2 |
line wrap: on
line source
use std::thread; use std::time; pub fn micros() -> u64 { loop { let now = time::SystemTime::now().duration_since(time::UNIX_EPOCH); match now { Err(_) => continue, Ok(dur) => return dur.as_secs() * 1000000 + (dur.subsec_nanos() / 1000) as u64, } } } pub fn sleep_for(micros: u32) { thread::sleep(time::Duration::new(0, micros * 1000)); }