并发 ART (自适应根树)
A Rust implementation of ART-OLC concurrent adaptive radix tree. It implements the optimistic lock coupling with proper SIMD support.
It only supports (and is optimized for) fixed sized 8 byte key; due to this specialization, congee has great performance -- basic operations are faster than most hash tables, range scan is an order of magnitude faster.
The codebase is extensively tested with {address|leak} sanitizer as well as libfuzzer. Congee's performance is continuously tracked here.
Congee aims to be a simple and reliable primitive for building database systems.
use congee::Congee;
use std::sync::Arc;
let art = Congee::new();
let guard = art.pin(); // enter an epoch
let value = Arc::new(String::from("hello"));
art.insert(1, value.clone(), &guard).unwrap();
let retrieved = art.get(1, &guard).unwrap();
assert_eq!(retrieved.as_ref(), "hello");
// Update
art.compute_if_present(
1,
|current| Some(Arc::new(format!("{} world", current))),
&guard
);
let updated = art.get(1, &guard).unwrap();
assert_eq!(updated.as_ref(), "hello world");
let removed = art.remove(1, &guard).unwrap();
assert_eq!(removed.as_ref(), "hello world");use congee::CongeeRaw;
let art = CongeeRaw::default();
let guard = art.pin(); // enter an epoch
art.insert(0, 42, &guard); // insert a value
let val = art.get(&0, &guard).unwrap(); // read the value
assert_eq!(val, 42);
let mut scan_buffer = vec![(0, 0); 8];
let scan_result = art.range(&0, &10, &mut scan_buffer, &guard); // scan values
assert_eq!(scan_result, 1);
assert_eq!(scan_buffer[0], (0, 42));Benchmarked with the conc-map-bench
暂无开放 Issues,或尚未同步最近议题。