Faster.Map
3.0.3.1
See the version list below for details.
dotnet add package Faster.Map --version 3.0.3.1
NuGet\Install-Package Faster.Map -Version 3.0.3.1
<PackageReference Include="Faster.Map" Version="3.0.3.1" />
paket add Faster.Map --version 3.0.3.1
#r "nuget: Faster.Map, 3.0.3.1"
// Install Faster.Map as a Cake Addin #addin nuget:?package=Faster.Map&version=3.0.3.1 // Install Faster.Map as a Cake Tool #tool nuget:?package=Faster.Map&version=3.0.3.1
Faster.Map - fastest c# hashmap
The goal of Faster is to provide the fastest dict/set that integrates into the .net scientific ecosystem.
Faster.Map uses the following:
- Open addressing
- Linear probing
- Upper limit on the probe sequence lenght(psl) which is Log2(size)
- Fibonacci hashing
About
Faster is a small robinhood hashmap with minimal memory overhead and incredibly fast runtime speed. See benchmarks, or try it out yourself. Faster.Map evolved from the fact that C# dictionaries in targetframework 4.0 are terribly slow. So i decided to create my own robinhood hashmap, turns out that this hashmap even performs better than the current dictionary written in .net5.
How to use
Faster.Map provides 3 unique hashmaps:
- FastMap<Tkey, TValue> is a hashmap which is highly optimized to be used with numerical keys.
- Map<Tkey, TValue> is a hashmap which can be used as a replacement to IDicionary.
- MultiMap<Tkey, Tvalue> is a hashmap that contains of key-value pairs, while permitting multiple entries with the same key. All key-value pairs are stored in a linear fashion and wont require additional Lists e.g Dictionary<int, List<string>>
Examples
Default Example
private FastMap<uint, uint> _map = new FastMap<uint, uint>(16);
_map.Emplace(1, 50);
_map.Remove(1);
_map.Get(1, out var result);
_map.Update(1, 51);
var result = _map[1];
Map Example
private Map<uint, uint> _map = new Map<uint, uint>(16);
_map.Emplace(1, 50);
_map.Remove(1);
_map.Get(1, out var result);
_map.Update(1, 51);
MultiMap Example
private MultiMap<uin,t uint> _multimap = new Map<uint, uint>(16);
_multimap.Emplace(1, 50);
_multimap.Remove(24, 24);
_multimap.RemoveAll(1);
_multimap.Update(1, 50);
_multimap.Get(1, out var result);
_multimap.GetAll(1);
Benchmark
Method | N | Mean | Error | StdDev | BranchInstructionRetired/Op | CacheMisses/Op | LLCMisses/Op |
---|---|---|---|---|---|---|---|
FastMap | 1000000 | 1.451 ms | 0.0155s | 0.0145ms | 3015435 | 175 | 232 |
Map | 1000000 | 3.451 ms | 0.0102s | 0.0095ms | 8040841 | 610 | 3358 |
Dictionary | 1000000 | 6.902 ms | 0.1305 ms | 0.1451 ms | 11,075,4822 | 1050 | 922 |
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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net40 is compatible. net403 was computed. net45 is compatible. net451 was computed. net452 was computed. net46 is compatible. net461 was computed. net462 was computed. net463 was computed. net47 is compatible. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
This package has no dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Faster.Map:
Package | Downloads |
---|---|
Faster.Ioc
Package Description |
|
UPSRestApi
UpsRestApi library for .Net used to access UPS API Catalog to browse products and view documentation. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
6.1.1 | 83 | 10/31/2024 |
6.1.0 | 88 | 10/31/2024 |
6.0.4 | 108 | 10/13/2024 |
6.0.3 | 168 | 9/4/2024 |
6.0.2 | 103 | 9/3/2024 |
6.0.1 | 96 | 9/1/2024 |
6.0.0 | 126 | 8/7/2024 |
5.0.4 | 882 | 4/16/2024 |
5.0.3 | 486 | 11/18/2023 |
5.0.2 | 221 | 10/29/2023 |
5.0.1 | 137 | 10/29/2023 |
5.0.0 | 157 | 10/28/2023 |
4.2.1 | 303 | 9/2/2023 |
4.2.0 | 2,196 | 4/24/2023 |
4.1.6 | 242 | 4/24/2023 |
4.1.5 | 348 | 3/19/2023 |
4.1.4 | 338 | 3/14/2023 |
4.1.3 | 298 | 3/14/2023 |
4.1.2 | 269 | 3/14/2023 |
4.1.1 | 860 | 3/10/2023 |
4.1.0 | 300 | 3/9/2023 |
4.0.9 | 293 | 3/9/2023 |
4.0.8 | 290 | 3/9/2023 |
4.0.7 | 313 | 3/6/2023 |
4.0.6 | 341 | 3/3/2023 |
4.0.5 | 325 | 3/1/2023 |
4.0.4 | 407 | 2/24/2023 |
4.0.3 | 362 | 2/23/2023 |
4.0.2 | 1,146 | 1/7/2023 |
4.0.1 | 400 | 1/6/2023 |
4.0.0 | 381 | 1/4/2023 |
3.0.4.2 | 747 | 12/22/2022 |
3.0.3.9 | 1,091 | 12/9/2022 |
3.0.3.8 | 758 | 11/8/2022 |
3.0.3.7 | 520 | 10/27/2022 |
3.0.3.6 | 536 | 10/18/2022 |
3.0.3.5 | 435 | 10/18/2022 |
3.0.3.4 | 1,108 | 9/20/2022 |
3.0.3.3 | 1,259 | 5/19/2022 |
3.0.3.2 | 481 | 5/17/2022 |
3.0.3.1 | 474 | 5/17/2022 |
3.0.3 | 476 | 5/17/2022 |
3.0.2 | 491 | 5/15/2022 |
- Multi targetting, Faster.Map is now applicable for net40;net45;net46;net47;net48;netstandard20
- Minor bug fixes
- api changes
- Add multimap to available hashmaps