PrestoPrimitives
PrestoPrimitives is a collection of high-performance, low-allocation primitives for building fast, responsive, and scalable .NET applications.
The project currently contains three independent NuGet packages. Each package is standalone, but they all follow the same principles: minimal allocations, low latency, predictable behavior, and clean APIs.
Packages
- CoalescingQueue: High-throughput coalescing queue.
- Threading: Lightweight async synchronization primitives.
- UniquePriorityQueue: Unique, priority-preserving queue.
CoalescingQueue
CoalescingQueue is a high-throughput queue with adaptive coalescing behavior. It merges consecutive items of the same type when the consumer falls behind, while preserving global FIFO ordering across different item types.
Highlights:
- Adaptive coalescing under load
- Multi-type queue with strict ordering
- Zero-copy producer path
- Suitable for real-time systems, games, and telemetry pipelines
PrestoPrimitives.Threading
Threading contains lightweight synchronization primitives such as AsyncAutoResetEventSlim, designed for low latency and high contention scenarios.
Highlights:
- Allocation-free async wake-ups
- Ultra-fast reset/wait mechanics
- Suitable for high-frequency async coordination
UniquePriorityQueue
UniquePriorityQueue is a priority queue that guarantees uniqueness of elements while maintaining priority ordering.
Highlights:
- Efficient enqueue/dequeue operations
- Ensures no duplicate items
- Can be used in task scheduling, game logic, or event processing pipelines