Konsarpoo 4.0.0
See the version list below for details.
dotnet add package Konsarpoo --version 4.0.0
NuGet\Install-Package Konsarpoo -Version 4.0.0
<PackageReference Include="Konsarpoo" Version="4.0.0" />
paket add Konsarpoo --version 4.0.0
#r "nuget: Konsarpoo, 4.0.0"
// Install Konsarpoo as a Cake Addin #addin nuget:?package=Konsarpoo&version=4.0.0 // Install Konsarpoo as a Cake Tool #tool nuget:?package=Konsarpoo&version=4.0.0
Konsarpoo .NET
The eco friendly set of array pool based and ref struct collections for netstandard2.1
.
Array pool container's storage allocated and recycled back to shared memory pool by default. It has up to 30% overhead on filling out with data and the similar performance for data look up.
Ref struct collections allow you to write high performance and zero allocation data processing code using up to 8mb of memory (1mb is default).
List of generic collections and APIs supported:
Array
List
Map
Set
Stack
Queue
Some extras built in:
BitArr
Lfu Cache
- std::vector api
- Python like APIs. Append methods,
+
-
, equality operators overloaded. - Lambda allocation free enumerable extensions
Each array pool collection is serializable by default. It has a class destructor defined and System.IDisposable
interface implemented to recycle internal storage on demand or by GC
.
Possible use cases of this package:
- Avoiding allocating large arrays in LOH (please call -
KonsarpooAllocatorGlobalSetup.SetGcAllocatorSetup()
) - Managing the available memory by providing custom allocator (please call -
KonsarpooAllocatorGlobalSetup.SetDefaultAllocatorSetup([your allocator impl])
) - Boosting performance if data processing task can be split into a smaller ones and memory allocated per task can fit into the stack.
Nuget
Please use one of the following commands to install Konsarpoo.
Package Manager
PM> Install-Package Konsarpoo -Version 4.0.0
.NET CLI
> dotnet add package Konsarpoo --version 4.0.0
DATA
The universal random access data container. Supports List
, Array
, Stack
and Queue
API's. Data<T>
has a minor overhead on adding items using default settings and huge advantage of reusing arrays to reduce GC
collection time.
Implemented as a tree of .NET
sub arrays. The array allocator and max size of array length per node may be set up for each instance, globally or globally for T
.
The GcArrayPoolMixedAllocator<T>
instance is the default array allocator. It takes advantage of GC and pool array. For small arrays with length 65 or less, it uses GC
for larger ones the System.Buffers.ArrayPool<T>.Shared
class.
MAP
Map<K,V>
is generic hashtable collection that supports the built in Dictionary
API. To manage Map
internal state the Konsarpoo.Collections.Data
comes to the stage.
SET
Set<T>
was designed to replace the System.Collections.Generic.HashSet
container with ArrayPool based collection. Implemented in the same way as the Map<K,V>
with keys collections only.
STACK API / QUEUE API
The Konsarpoo.Collections.Data
class supports Stack
and Queue
API with linear time performance for modifying methods. To access Queue
API it is required to call Data.AsQueue()
method which returns wrapper class with Data<T>
as internal storage that keeps track of the start of queue.
BITARR
It is a compact array of bit values, which are represented as Booleans. It uses Data<int>
as internal storage.
LFU CACHE
A data structure which uses an O(1) algorithm of implementing LFU cache eviction scheme. It has a map like API and simple cleanup methods to remove a certain number of non-relevant items from the cache. In addition to that it can keep track of cached data obsolescence by last accessed timestamp and remove those obsolete items on demand.
Stackalloc and ref struct
There are basic collections implemented:
DataRs
MapRs
SetRs
QueueRs
StackRs
It turned out that overall performance of stackalloc containers are up to 10 times faster in compare to heap allocated one.
Examples of usages:
DataRs
Span<int> memory = stackalloc int[10_000];
var dataRs = new DataRs<int>(ref memory);
dataRs.Add(1);
var first = dataRs.FirstOrDefault();
Assert.AreEqual(1, first);
Assert.AreEqual(1, dataRs.Count);
License
MIT
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- JetBrains.Annotations (>= 2021.3.0)
- System.Buffers (>= 4.5.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
5.1.1 | 122 | 7/3/2024 |
5.1.0 | 95 | 6/29/2024 |
5.0.5 | 103 | 6/28/2024 |
5.0.4 | 115 | 6/18/2024 |
5.0.3 | 113 | 6/18/2024 |
5.0.2 | 107 | 6/15/2024 |
5.0.1 | 104 | 6/12/2024 |
5.0.0 | 98 | 6/8/2024 |
4.2.0 | 141 | 2/1/2024 |
4.1.4 | 124 | 1/19/2024 |
4.1.3 | 110 | 1/19/2024 |
4.1.2 | 164 | 1/4/2024 |
4.1.1 | 141 | 1/4/2024 |
4.1.0 | 136 | 12/25/2023 |
4.0.2 | 135 | 12/19/2023 |
4.0.1 | 113 | 12/18/2023 |
4.0.0 | 147 | 9/27/2023 |
3.0.0 | 203 | 4/28/2023 |
2.1.0 | 267 | 2/18/2023 |
2.0.4 | 252 | 2/17/2023 |
2.0.3 | 247 | 2/17/2023 |
2.0.2 | 261 | 2/17/2023 |
2.0.1 | 260 | 2/17/2023 |
1.0.2 | 416 | 10/11/2022 |
1.0.1 | 476 | 2/12/2022 |
1.0.0 | 446 | 2/11/2022 |