Expand description
Thread-local memory pools for zero-contention parallel execution
This module provides thread-local buffer pools that eliminate contention in multi-threaded scenarios. Each thread maintains its own pool, avoiding the need for locks or atomic operations.
§Performance Benefits
- Zero Contention: No locks needed, each thread has its own pool
- Cache Locality: Thread-local data improves cache hit rates
- Parallel Scalability: Linear scaling with thread count
- Low Overhead: ~10-20ns per acquire/release (vs ~100ns+ with locks)
§Usage
use tenrso_exec::executor::thread_local_pool::ThreadLocalPoolManager;
// Enable thread-local pooling
let manager = ThreadLocalPoolManager::new();
manager.enable();
// In parallel code, each thread will use its own pool
let buffer = manager.acquire_f64(&[1000]);
// ... use buffer ...
manager.release_f64(&[1000], buffer);Structs§
- Aggregated
Pool Stats - Statistics aggregated across all threads
- Thread
Local Pool Manager - Manager for thread-local memory pools
- Thread
Local Pool Stats - Statistics for a thread-local pool