Crate lock_free

Crate lock_free 

Source
Expand description

A collection of high-performance lock-free data structures for Rust.

This crate provides thread-safe, lock-free implementations of common data structures that can be used in concurrent environments without the overhead of traditional locking mechanisms.

§Performance

  • Stack: 24M+ ops/sec
  • Queue: 25M+ ops/sec
  • List: 3M+ ops/sec (O(log n) skip list)
  • HashMap: 10-30M+ ops/sec (scales with threads)

§Example

use lock_free::{Stack, Queue, List, HashMap};

// High-performance stack
let stack = Stack::new();
stack.push(42);
assert_eq!(stack.pop(), Some(42));

// Fast bounded queue
let queue = Queue::new(1024);
queue.enqueue("hello");
assert_eq!(queue.dequeue(), Some("hello"));

// Ordered key-value list
let list = List::new();
list.insert("key", "value");
assert!(list.contains(&"key"));

// Fast concurrent hashmap
let map = HashMap::new();
map.insert("key", "value");
assert_eq!(map.get(&"key"), Some("value"));

Re-exports§

pub use skiplist_fast::FastSkipList as List;
pub use hashmap_ultra::UltraHashMap as HashMap;

Modules§

collections
Collection utilities High-level collection types that choose the best implementation.
hashmap_fast
Ultra-fast lock-free HashMap using open addressing
hashmap_ultra
Ultra-optimized lock-free HashMap with world-class performance
list_o1
O(1) Lock-free List Implementations
skiplist
Simplified high-performance lock-free skip list.
skiplist_fast
Ultra-fast lock-free skip list implementation
variants
Alternative implementations for specific use cases.

Structs§

BoundedQueue
High-performance bounded queue
Queue
High-performance bounded queue
Stack
A lock-free stack implementation using Treiber’s algorithm.