Crates.io | sarlacc |
lib.rs | sarlacc |
version | 0.1.4 |
created_at | 2025-05-18 16:59:29.622654+00 |
updated_at | 2025-07-26 18:20:04.035922+00 |
description | Thread-safe lock-free interning of data |
homepage | |
repository | https://gitlab.com/hrovnyak/sarlacc |
max_upload_size | |
id | 1678773 |
size | 85,760 |
Some say that it takes 1000 years for your data to be freed...
Sarlacc is a crate for easy interning of data in Rust. Interning is the process of deduplicating equal values in memory, allowing them to be hashed and checked for equality through quick and efficient pointer comparison.
This crate aims to have feature parity with the popular internment crate, however interning is implemented using a Ctrie, which is a lock-free hash set that synchronizes using atomics. The internment crate simply hides everything behind a global mutex.
Now you may be wondering... Why would you want to leak your entire memory stick BLAZINGLY FAST 🚀🚀🚀???
Todos:
ArcIntern
functionalitylet a = Intern::from_ref("Hello");
let b = Intern::from_ref("world");
assert_ne!(a, b);
println!("{a}, {b}");
let also_a = Intern::from_ref("Hello");
assert_eq!(a, also_a);
assert!(ptr::eq(&*a, &*also_a));
Note: This crate uses a ton of unsafe code and is my way of learning unsafe and atomics; it's probably a fairly risky dependency to use