https://github.com/yasushi-saito/lpcuckoohashrs
Cuckoo hashtable written in Rust
https://github.com/yasushi-saito/lpcuckoohashrs
cuckoo hashmap rust
Last synced: 2 days ago
JSON representation
Cuckoo hashtable written in Rust
- Host: GitHub
- URL: https://github.com/yasushi-saito/lpcuckoohashrs
- Owner: yasushi-saito
- Created: 2019-12-16T07:33:10.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-16T19:12:01.000Z (almost 6 years ago)
- Last Synced: 2025-03-16T02:18:23.531Z (7 months ago)
- Topics: cuckoo, hashmap, rust
- Language: Rust
- Homepage:
- Size: 11.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Lehman-Panigrahy Cuckoo hash table.
Cuckoo hash can look up an element with at most two probes, guaranteed. On
hash conflict during insertion, elements are moved around to make room for
the new element, hence the name cuckoo.The basic algorithm is described in the following paper:
3.5-way Cockoo Hashing for the price of 2-and-a-bit. Eric Lehman and Rita
Panigrahy, European Symp. on Algorithms, 2009.https://pdfs.semanticscholar.org/aa7f/47954647604107fd5e67fa8162c7a785de71.pdf
It also incorporates some of the ideas presented in the following paper:
Algorithmic Improvements for Fast Concurrent Cuckoo Hashing, Xiaozhou Li,
David G. Andersen, Michael Kaminsky, Michael J. Freedman, Eurosys 14.https://www.cs.princeton.edu/~mfreed/docs/cuckoo-eurosys14.pdf
# Examples
```
use lpcuckoo::LpCuckooHashMap;let mut map = LpCuckooHashMap::new();
map.insert("key0".to_string(), "val0".to_string());
map.insert("key1".to_string(), "val1".to_string());
assert_eq!(map.get("key0"), Some("val0".to_string()));
assert_eq!(map.remove_entry("key0"), Some(("key0".to_string(), "val0".to_string())));
assert_eq!(map.get("key0"), None);
```# Benchmarks
On Core i5 5300U 2.3GHz, using seahash:
- insert one entry: 100ns
- insert 16 entries: 518ns
- insert 128 entries: 22us
- lookup one entry: 15ns