Faster.Collections.Pooled
1.0.2
See the version list below for details.
dotnet add package Faster.Collections.Pooled --version 1.0.2
NuGet\Install-Package Faster.Collections.Pooled -Version 1.0.2
<PackageReference Include="Faster.Collections.Pooled" Version="1.0.2" />
<PackageVersion Include="Faster.Collections.Pooled" Version="1.0.2" />
<PackageReference Include="Faster.Collections.Pooled" />
paket add Faster.Collections.Pooled --version 1.0.2
#r "nuget: Faster.Collections.Pooled, 1.0.2"
#:package Faster.Collections.Pooled@1.0.2
#addin nuget:?package=Faster.Collections.Pooled&version=1.0.2
#tool nuget:?package=Faster.Collections.Pooled&version=1.0.2
Faster.Collections.Pooled
A high-performance collection library for .NET 10+ that provides pooled alternatives to standard collections, reducing GC pressure and improving throughput.
Features
- Array Pooling - All collections leverage shared array pools to minimize allocations
- High-Performance Hashing - Includes optimized hash algorithms (FastHash, WyHash, xxHash3, CRC32) powered by
Faster.Map. - Drop-in Replacements - Compatible APIs for Dictionary, List, Queue, Stack, and PriorityQueue.
- Comprehensive Testing - Includes comparison tests against BCL collections.
- Benchmarking - Includes a dedicated benchmarking project for performance evaluation.
API Compatibility
| Collection | API Source |
|---|---|
PooledList<T> |
List<T> |
PooledQueue<T> |
Queue<T> |
PooledStack<T> |
Stack<T> |
PooledPriorityQueue<TElement, TPriority> |
PriorityQueue<TElement, TPriority> |
PooledDictionary<TKey, TValue> |
FasterMap.BlitzMap<TKey, TValue> + Interfaces* of Dictionary<TKey, TValue> |
* PooledDictionary implements standard interfaces of Dictionary<TKey, TValue> except ISerializable and IDeserializationCallback
Installation
NuGet Package
dotnet add package Faster.Collections.Pooled
Build from Source
dotnet fsi build.fsx build
Performance
Sometimes, benchmark-dotnet or GC will allocate small amount of memory.
For exmaple, the benchmark below shows System.Collections.Generic.PriorityQueue<TElement, TPriority>.Dequeue allocates 0 B, but it may allocate a few bytes in some runs.
| Method | N | Mean | Error | StdDev | Median | Ratio | RatioSD | Allocated | Alloc Ratio |
|---|---|---|---|---|---|---|---|---|---|
| OriginPriorityQueueDequeue | 100 | 2,741.8 ns | 168.45 ns | 472.36 ns | 2,700.0 ns | 1.03 | 0.24 | 336 B | 1.00 |
| PooledPriorityQueueDequeue | 100 | 2,847.4 ns | 158.32 ns | 454.26 ns | 2,800.0 ns | 1.07 | 0.24 | - | 0.00 |
| OriginPriorityQueueDequeue | 1000 | 41,531.0 ns | 826.78 ns | 1,211.88 ns | 41,400.0 ns | 1.00 | 0.04 | - | NA |
| PooledPriorityQueueDequeue | 1000 | 42,242.9 ns | 783.69 ns | 694.72 ns | 42,250.0 ns | 1.02 | 0.03 | - | NA |
PooledList vs List
Add
Speed up 85%, no allocations.
Remove
Almost same speed, no allocations.
PooledDictionary vs Dictionary
Speed up 298%, no allocations.
Speed up 58%, no allocations.
PooledQueue vs Queue
Enqueue
Speed up 65%, no allocations.
Dequeue
Almost same speed, no allocations.
PooledStack vs Stack
Push
Speed up 86%, no allocations.
Pop
Almost same speed, no allocations.
PooledPriorityQueue vs PriorityQueue
Enqueue
Speed up 71%, no allocations.
Dequeue
Almost same speed, no allocations.
Roadmap
-
PooledHashset(based onFaster.Map.BlitzSet) -
ISerializableandIDeserializationCallbacksupport forPooledDictionary
Acknowledgments
Very special thanks to the following projects:
- Faster.Map - High-performance hashing algorithms
- Collections.Pooled - Pooled collection implementations
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- System.IO.Hashing (>= 10.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.