Skip to content

Commit

Permalink
Update benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
Wsm2110 committed Nov 23, 2024
1 parent 80763cd commit d3cbb26
Showing 1 changed file with 32 additions and 51 deletions.
83 changes: 32 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Faster.Map
# Faster.Map

The goal of Faster.Map is to create a more efficient and performant alternative to the Dictionary and ConcurrentDictionary classes provided by .NET.
These standard collections are widely used for key-value pair storage in .NET applications, but they have certain limitations, particularly in high-performance and concurrent scenarios.
Expand Down Expand Up @@ -243,57 +243,38 @@ BenchmarkDotNet v0.13.12, Windows 11 (10.0.22631.3880/23H2/2023Update/SunValley3

### Get String Benchmark

| Method | Length | Mean (ms) | Error (ms) | StdDev (ms) | Allocated |
|-------------------|---------|-----------------|---------------|---------------|-----------|
| DenseMap_Default | 100 | 0.7877 | 0.00488 | 0.00407 | - |
| DenseMap_Xxhash3 | 100 | 0.5638 | 0.00237 | 0.00210 | - |
| DenseMap_GxHash | 100 | 0.4934 | 0.00495 | 0.00463 | - |
| **DenseMap_FastHash** | **100** | **0.4423** | 0.00184 | 0.00144 | - |
| RobinhoodMap | 100 | 0.6755 | 0.00825 | 0.00771 | - |
| Dictionary | 100 | 0.6573 | 0.01266 | 0.01408 | - |
| DenseMap_Default | 1000 |7.9540 | 0.15528 | 0.13765 | - |
| DenseMap_Xxhash3 | 1000 | 5.9863 | 0.11213 | 0.11013 | - |
| DenseMap_GxHash | 1000 | 5.2577 | 0.03646 | 0.03411 | - |
| **DenseMap_FastHash** | **1000** | **4.5143** | 0.08599 | 0.09558 | - |
| RobinhoodMap | 1000 | 7.8287 | 0.05559 | 0.04928 | - |
| Dictionary | 1000 | 7.4062 | 0.13805 | 0.12914 | - |
| DenseMap_Default | 10000 | 115.7674 | 0.37631 | 0.33359 | - |
| DenseMap_Xxhash3 | 10000 | 89.3335 | 0.30373 | 0.23713 | - |
| DenseMap_GxHash | 10000 | 89.3103 | 0.52041 | 0.46133 | - |
| **DenseMap_FastHash** | **10000** | **81.7969** | 0.61676 | 0.54674 | - |
| RobinhoodMap | 10000 | 111.0056 | 1.03930 | 0.97216 | - |
| Dictionary | 10000 | 142.7456 | 0.56217 | 0.49835 | - |
| DenseMap_Default | 100000 | 1567.0900 | 17.38346 | 14.51598 | 1 B |
| DenseMap_Xxhash3 | 100000 | 1154.3523 | 3.08295 | 2.73296 | 1 B |
| DenseMap_GxHash | 100000 | 1215.4789 | 4.05174 | 3.16333 | 1 B |
| **DenseMap_FastHash** | **100000** | **1032.0671** | 10.77159 | 8.99477 | 1 B |
| RobinhoodMap | 100000 | 1864.2588 | 22.85317 | 19.08343 | 1 B |
| Dictionary | 100000 | 1882.8305 | 35.33849 | 42.06796 | 1 B |
| DenseMap_Default | 200000 | 3627.3379 | 68.77079 | 86.97303 | 3 B |
| DenseMap_Xxhash3 | 200000 | 2558.1723 | 10.47182 | 8.74444 | 3 B |
| DenseMap_GxHash | 200000 | 2661.8776 | 49.53749 | 43.91369 | 3 B |
| **DenseMap_FastHash** | **200000 ** | **2252.3690** | 35.63210 | 33.33029 | 3 B |
| RobinhoodMap | 200000 | 5201.6671 | 55.90280 | 49.55637 | 6 B |
| Dictionary | 200000 | 3900.8612 | 18.59936 | 15.53131 | 3 B |
| DenseMap_Default | 400000 | 8787.455 | 102.67141 | 96.03890 | 12 B |
| DenseMap_Xxhash3 | 400000 | 6620.0023 | 101.26791 | 89.77137 | 12 B |
| DenseMap_GxHash | 400000 | 6252.5252 | 24.02417 | 22.47222 | 6 B |
| **DenseMap_FastHash** | **400000** | **5609.3088** | 28.09836 | 23.46340 | 6 B |
| RobinhoodMap | 400000 | 17440.6204 | 115.65609 | 108.18478 | 23 B |
| Dictionary | 400000 | 8838.5934 | 52.30617 | 46.36806 | 12 B |
| DenseMap_Default | 800000 | 29897.6681 | 183.71964 | 162.86268 | 23 B |
| DenseMap_Xxhash3 | 800000 | 23740.6419 | 461.06354 | 512.47090 | 23 B |
| DenseMap_GxHash | 800000 | 18662.8382 | 163.51705 | 136.54414 | 23 B |
| **DenseMap_FastHash** | **800000** | **17516.7710** | 173.69462 | 145.04287 | 23 B |
| RobinhoodMap | 800000 | 45399.0412 | 752.47203 | 703.86280 | 67 B |
| Dictionary | 800000 | 26328.6341 | 122.59703 | 95.71569 | 23 B |
| DenseMap_Default | 1000000 | 43746.8455 | 255.44660 | 238.94491 | 67 B |
| DenseMap_Xxhash3 | 1000000 | 30988.9967 | 138.94068 | 129.96520 | 46 B |
| DenseMap_GxHash | 1000000 | 23901.5047 | 91.89792 | 81.46511 | 23 B |
| **DenseMap_FastHash** | **1000000** | **22579.2328** | 60.22346 | 50.28931 | 23 B |
| RobinhoodMap | 1000000 | 62235.2917 | 339.28829 | 317.37048 | 92 B |
| Dictionary | 1000000 | 34091.9248 | 387.37558 | 343.39836 | 49 B |
This benchmark compares the performance of different hash map implementations for various input sizes. The **Mean (ms)** column represents the average time taken for each operation. The fastest implementation for each input size is highlighted in bold.

| Method | Length | Mean (ms) | Error (ms) | StdDev (ms) | Allocated |
|-------------------|---------|----------------|----------------|----------------|-----------|
| DenseMap_Default | 100 | 0.000788 | 0.000005 | 0.000004 | - |
| DenseMap_Xxhash3 | 100 | 0.000564 | 0.000002 | 0.000002 | - |
| DenseMap_GxHash | 100 | 0.000493 | 0.000005 | 0.000005 | - |
| **DenseMap_FastHash** 🏆 | **100** | **0.000442** | **0.000002** | **0.000001** | **-** |
| RobinhoodMap | 100 | 0.000676 | 0.000008 | 0.000008 | - |
| Dictionary | 100 | 0.000657 | 0.000013 | 0.000014 | - |
| DenseMap_Default | 1000 | 0.007954 | 0.000155 | 0.000138 | - |
| DenseMap_Xxhash3 | 1000 | 0.005986 | 0.000112 | 0.000110 | - |
| DenseMap_GxHash | 1000 | 0.005258 | 0.000036 | 0.000034 | - |
| **DenseMap_FastHash** 🏆 | **1000** | **0.004514** | **0.000086** | **0.000096** | **-** |
| RobinhoodMap | 1000 | 0.007829 | 0.000056 | 0.000049 | - |
| Dictionary | 1000 | 0.007406 | 0.000138 | 0.000129 | - |
| DenseMap_Default | 10000 | 0.115767 | 0.000376 | 0.000334 | - |
| DenseMap_Xxhash3 | 10000 | 0.089334 | 0.000304 | 0.000237 | - |
| DenseMap_GxHash | 10000 | 0.089310 | 0.000520 | 0.000461 | - |
| **DenseMap_FastHash** 🏆 | **10000** | **0.081797** | **0.000617** | **0.000547** | **-** |
| RobinhoodMap | 10000 | 0.111006 | 0.001039 | 0.000972 | - |
| Dictionary | 10000 | 0.142746 | 0.000562 | 0.000498 | - |
| DenseMap_Default | 100000 | 1.567090 | 0.017383 | 0.014516 | 1 B |
| DenseMap_Xxhash3 | 100000 | 1.154352 | 0.003083 | 0.002733 | 1 B |
| DenseMap_GxHash | 100000 | 1.215479 | 0.004052 | 0.003163 | 1 B |
| **DenseMap_FastHash** 🏆 | **100000** | **1.032067** | **0.010772** | **0.008995** | **1 B** |
| RobinhoodMap | 100000 | 1.864259 | 0.022853 | 0.019083 | 1 B |
| Dictionary | 100000 | 1.882831 | 0.035338 | 0.042068 | 1 B |

🏆 indicates the fastest implementation for each input size.

---

### Add string benchmark

Expand Down

0 comments on commit d3cbb26

Please sign in to comment.