Skip to content

Commit a9201fc

Browse files
committed
docs: Update the benchmark doc
1 parent 72f392b commit a9201fc

File tree

1 file changed

+75
-38
lines changed

1 file changed

+75
-38
lines changed

README.md

Lines changed: 75 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44

55
Library Bloom filters in C#
66

7-
8-
Packages & Status
9-
---
7+
## Packages & Status
108

119
Package | NuGet |
1210
-------- | :------------ |
@@ -16,11 +14,10 @@ Package | NuGet |
1614
|**BloomFilter.FreeRedis.NetCore**|[![NuGet package](https://buildstats.info/nuget/BloomFilter.FreeRedis.NetCore)](https://www.nuget.org/packages/BloomFilter.FreeRedis.NetCore)
1715
|**BloomFilter.EasyCaching.NetCore**|[![NuGet package](https://buildstats.info/nuget/BloomFilter.EasyCaching.NetCore)](https://www.nuget.org/packages/BloomFilter.EasyCaching.NetCore)
1816

19-
20-
Usage
21-
---
17+
## Usage
2218

2319
In Memory
20+
2421
```cs
2522
public class Demo
2623
{
@@ -34,7 +31,9 @@ In Memory
3431
}
3532

3633
```
34+
3735
Configurations
36+
3837
```cs
3938
var services = new ServiceCollection();
4039
services.AddBloomFilter(setupAction =>
@@ -49,6 +48,7 @@ Console.WriteLine(bf.Contains("Value"));
4948
```
5049

5150
Use Redis
51+
5252
```cs
5353
public class Demo
5454
{
@@ -63,6 +63,7 @@ Use Redis
6363
```
6464

6565
StackExchange.Redis
66+
6667
```cs
6768
var services = new ServiceCollection();
6869
services.AddBloomFilter(setupAction =>
@@ -82,6 +83,7 @@ Console.WriteLine(bf.Contains("Value"));
8283
```
8384

8485
CSRedisCore
86+
8587
```cs
8688
var services = new ServiceCollection();
8789
services.AddBloomFilter(setupAction =>
@@ -101,6 +103,7 @@ Console.WriteLine(bf.Contains("Value"));
101103
```
102104

103105
FreeRedis
106+
104107
```cs
105108
var services = new ServiceCollection();
106109
services.AddBloomFilter(setupAction =>
@@ -120,6 +123,7 @@ Console.WriteLine(bf.Contains("Value"));
120123
```
121124

122125
EasyCaching
126+
123127
```cs
124128
var services = new ServiceCollection();
125129

@@ -175,41 +179,74 @@ bf1.Add("Value");
175179
Console.WriteLine(bf1.Contains("Value"));
176180
```
177181

178-
179-
Benchmark
180-
---
182+
## Benchmark
181183

182184
``` ini
183-
184-
ExpectedElements 1000000
185-
ErrRate 1%
186-
187-
BenchmarkDotNet=v0.12.1, OS=Windows 10.0.19042
185+
BenchmarkDotNet=v0.13.5, OS=Windows 11 (10.0.22621.1555/22H2/2022Update/SunValley2)
188186
AMD Ryzen 7 5800X, 1 CPU, 16 logical and 8 physical cores
189-
.NET Core SDK=5.0.203
190-
[Host] : .NET Core 5.0.6 (CoreCLR 5.0.621.22011, CoreFX 5.0.621.22011), X64 RyuJIT
191-
DefaultJob : .NET Core 5.0.6 (CoreCLR 5.0.621.22011, CoreFX 5.0.621.22011), X64 RyuJIT
192-
193-
187+
.NET SDK=7.0.203
188+
[Host] : .NET 7.0.5 (7.0.523.17405), X64 RyuJIT AVX2
189+
DefaultJob : .NET 7.0.5 (7.0.523.17405), X64 RyuJIT AVX2
194190
```
195191

192+
| Method | DataSize | Method | Mean | Error | StdDev | Min | Max | Rank | Gen0 | Allocated |
193+
|------- |--------- |--------------------- |------------:|----------:|----------:|------------:|------------:|-----:|-------:|----------:|
194+
| **Add** | **64** | **LCGWithFNV1** | **70.84 ns** | **0.108 ns** | **0.096 ns** | **70.71 ns** | **71.04 ns** | **3** | **0.0033** | **56 B** |
195+
| **Add** | **64** | **LCGWithFNV1a** | **71.30 ns** | **0.101 ns** | **0.095 ns** | **71.13 ns** | **71.43 ns** | **3** | **0.0033** | **56 B** |
196+
| **Add** | **64** | **LCGModifiedFNV1** | **82.04 ns** | **0.081 ns** | **0.072 ns** | **81.96 ns** | **82.19 ns** | **5** | **0.0033** | **56 B** |
197+
| **Add** | **64** | **RNGWithFNV1** | **334.09 ns** | **1.151 ns** | **0.961 ns** | **332.86 ns** | **335.50 ns** | **9** | **0.0215** | **360 B** |
198+
| **Add** | **64** | **RNGWithFNV1a** | **333.15 ns** | **0.633 ns** | **0.592 ns** | **332.28 ns** | **334.07 ns** | **9** | **0.0215** | **360 B** |
199+
| **Add** | **64** | **RNGModifiedFNV1** | **327.79 ns** | **0.882 ns** | **0.782 ns** | **326.52 ns** | **329.31 ns** | **8** | **0.0215** | **360 B** |
200+
| **Add** | **64** | **CRC32** | **881.59 ns** | **14.044 ns** | **13.137 ns** | **843.00 ns** | **894.94 ns** | **11** | **0.0057** | **96 B** |
201+
| **Add** | **64** | **CRC32u** | **1,033.64 ns** | **7.206 ns** | **6.741 ns** | **1,011.03 ns** | **1,039.04 ns** | **15** | **0.0057** | **96 B** |
202+
| **Add** | **64** | **Adler32** | **360.03 ns** | **7.200 ns** | **12.029 ns** | **346.10 ns** | **376.29 ns** | **10** | **0.0057** | **96 B** |
203+
| **Add** | **64** | **Murmur2** | **307.63 ns** | **0.296 ns** | **0.262 ns** | **306.99 ns** | **308.04 ns** | **7** | **0.0086** | **144 B** |
204+
| **Add** | **64** | **Murmur3** | **205.51 ns** | **0.335 ns** | **0.280 ns** | **205.15 ns** | **206.10 ns** | **6** | **0.0033** | **56 B** |
205+
| **Add** | **64** | **Murmu(...)acher [25]** | **75.97 ns** | **0.401 ns** | **0.375 ns** | **75.33 ns** | **76.46 ns** | **4** | **0.0033** | **56 B** |
206+
| **Add** | **64** | **SHA1** | **1,502.79 ns** | **7.317 ns** | **6.486 ns** | **1,489.20 ns** | **1,513.20 ns** | **16** | **0.0458** | **784 B** |
207+
| **Add** | **64** | **SHA256** | **925.28 ns** | **9.802 ns** | **8.689 ns** | **912.96 ns** | **938.76 ns** | **12** | **0.0391** | **664 B** |
208+
| **Add** | **64** | **SHA384** | **972.51 ns** | **8.110 ns** | **7.586 ns** | **961.46 ns** | **984.36 ns** | **14** | **0.0305** | **528 B** |
209+
| **Add** | **64** | **SHA512** | **944.82 ns** | **3.865 ns** | **3.615 ns** | **939.07 ns** | **949.79 ns** | **13** | **0.0353** | **592 B** |
210+
| **Add** | **64** | **XXHash32** | **39.12 ns** | **0.044 ns** | **0.039 ns** | **39.04 ns** | **39.17 ns** | **2** | **0.0033** | **56 B** |
211+
| **Add** | **64** | **XXHash64** | **32.19 ns** | **0.140 ns** | **0.124 ns** | **32.03 ns** | **32.45 ns** | **1** | **0.0033** | **56 B** |
212+
213+
## Hash ErrRate
196214

197-
198-
| Method | DataSize | Method | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
199-
|------- |--------- |--------------------- |------------:|----------:|----------:|-------:|------:|------:|----------:|
200-
| **Add** | **64** | **LCGWithFNV1** | **71.46 ns** | **0.562 ns** | **0.469 ns** | **0.0033** | **-** | **-** | **56 B** |
201-
| **Add** | **64** | **LCGWithFNV1a** | **71.46 ns** | **0.515 ns** | **0.456 ns** | **0.0033** | **-** | **-** | **56 B** |
202-
| **Add** | **64** | **LCGModifiedFNV1** | **73.68 ns** | **0.237 ns** | **0.210 ns** | **0.0033** | **-** | **-** | **56 B** |
203-
| **Add** | **64** | **RNGWithFNV1** | **376.15 ns** | **3.480 ns** | **3.085 ns** | **0.0200** | **-** | **-** | **336 B** |
204-
| **Add** | **64** | **RNGWithFNV1a** | **358.71 ns** | **1.896 ns** | **1.773 ns** | **0.0200** | **-** | **-** | **336 B** |
205-
| **Add** | **64** | **RNGModifiedFNV1** | **380.91 ns** | **3.113 ns** | **2.759 ns** | **0.0200** | **-** | **-** | **336 B** |
206-
| **Add** | **64** | **CRC32** | **849.82 ns** | **8.669 ns** | **8.109 ns** | **0.0057** | **-** | **-** | **96 B** |
207-
| **Add** | **64** | **CRC32u** | **1,126.47 ns** | **16.772 ns** | **14.006 ns** | **0.0057** | **-** | **-** | **96 B** |
208-
| **Add** | **64** | **Adler32** | **292.85 ns** | **5.753 ns** | **7.276 ns** | **0.0057** | **-** | **-** | **96 B** |
209-
| **Add** | **64** | **Murmur2** | **317.99 ns** | **2.378 ns** | **2.224 ns** | **0.0086** | **-** | **-** | **144 B** |
210-
| **Add** | **64** | **Murmur3** | **224.56 ns** | **0.938 ns** | **0.831 ns** | **0.0033** | **-** | **-** | **56 B** |
211-
| **Add** | **64** | **Murmu(...)acher [25]** | **79.59 ns** | **0.367 ns** | **0.343 ns** | **0.0033** | **-** | **-** | **56 B** |
212-
| **Add** | **64** | **SHA1** | **2,063.04 ns** | **13.598 ns** | **12.720 ns** | **0.0572** | **-** | **-** | **960 B** |
213-
| **Add** | **64** | **SHA256** | **935.44 ns** | **4.658 ns** | **4.129 ns** | **0.0391** | **-** | **-** | **664 B** |
214-
| **Add** | **64** | **SHA384** | **974.55 ns** | **2.792 ns** | **2.475 ns** | **0.0305** | **-** | **-** | **528 B** |
215-
| **Add** | **64** | **SHA512** | **908.09 ns** | **3.034 ns** | **2.838 ns** | **0.0353** | **-** | **-** | **592 B** |
215+
``` ini
216+
LCGWithFNV1 Capacity:958506,Hashes:7,ExpectedElements:100000,ErrorRate:0.01
217+
Speed:211.8174ms Count:100000 ErrRate:93.921 ErrTotal:93921 Final ErrRate:100.001
218+
LCGWithFNV1a Capacity:958506,Hashes:7,ExpectedElements:100000,ErrorRate:0.01
219+
Speed:189.4414ms Count:100000 ErrRate:93.929 ErrTotal:93929 Final ErrRate:100.001
220+
LCGModifiedFNV1 Capacity:958506,Hashes:7,ExpectedElements:100000,ErrorRate:0.01
221+
Speed:57.8939ms Count:100000 ErrRate:93.944 ErrTotal:93944 Final ErrRate:100.001
222+
RNGWithFNV1 Capacity:958506,Hashes:7,ExpectedElements:100000,ErrorRate:0.01
223+
Speed:249.5932ms Count:100000 ErrRate:0.163 ErrTotal:163 Final ErrRate:0.955
224+
RNGWithFNV1a Capacity:958506,Hashes:7,ExpectedElements:100000,ErrorRate:0.01
225+
Speed:287.2725ms Count:100000 ErrRate:0.180 ErrTotal:180 Final ErrRate:0.966
226+
RNGModifiedFNV1 Capacity:958506,Hashes:7,ExpectedElements:100000,ErrorRate:0.01
227+
Speed:195.7422ms Count:100000 ErrRate:0.150 ErrTotal:150 Final ErrRate:0.957
228+
CRC32 Capacity:958506,Hashes:7,ExpectedElements:100000,ErrorRate:0.01
229+
Speed:777.4468ms Count:100000 ErrRate:0.177 ErrTotal:177 Final ErrRate:1.018
230+
CRC32u Capacity:958506,Hashes:7,ExpectedElements:100000,ErrorRate:0.01
231+
Speed:892.5557ms Count:100000 ErrRate:0.163 ErrTotal:163 Final ErrRate:0.988
232+
Adler32 Capacity:958506,Hashes:7,ExpectedElements:100000,ErrorRate:0.01
233+
Speed:412.0247ms Count:100000 ErrRate:10.168 ErrTotal:10168 Final ErrRate:23.128
234+
Murmur2 Capacity:958506,Hashes:7,ExpectedElements:100000,ErrorRate:0.01
235+
Speed:391.489ms Count:100000 ErrRate:0.148 ErrTotal:148 Final ErrRate:1.032
236+
Murmur3 Capacity:958506,Hashes:7,ExpectedElements:100000,ErrorRate:0.01
237+
Speed:328.3029ms Count:100000 ErrRate:0.180 ErrTotal:180 Final ErrRate:0.977
238+
Murmur3KirschMitzenmacher Capacity:958506,Hashes:7,ExpectedElements:100000,ErrorRate:0.01
239+
Speed:87.3783ms Count:100000 ErrRate:0.152 ErrTotal:152 Final ErrRate:1.064
240+
SHA1 Capacity:958506,Hashes:7,ExpectedElements:100000,ErrorRate:0.01
241+
Speed:334.3553ms Count:100000 ErrRate:0.187 ErrTotal:187 Final ErrRate:0.954
242+
SHA256 Capacity:958506,Hashes:7,ExpectedElements:100000,ErrorRate:0.01
243+
Speed:203.8082ms Count:100000 ErrRate:0.187 ErrTotal:187 Final ErrRate:0.980
244+
SHA384 Capacity:958506,Hashes:7,ExpectedElements:100000,ErrorRate:0.01
245+
Speed:291.8822ms Count:100000 ErrRate:0.157 ErrTotal:157 Final ErrRate:1.008
246+
SHA512 Capacity:958506,Hashes:7,ExpectedElements:100000,ErrorRate:0.01
247+
Speed:292.8556ms Count:100000 ErrRate:0.151 ErrTotal:151 Final ErrRate:0.958
248+
XXHash32 Capacity:958506,Hashes:7,ExpectedElements:100000,ErrorRate:0.01
249+
Speed:82.8759ms Count:100000 ErrRate:0.170 ErrTotal:170 Final ErrRate:1.017
250+
XXHash64 Capacity:958506,Hashes:7,ExpectedElements:100000,ErrorRate:0.01
251+
Speed:42.8872ms Count:100000 ErrRate:0.153 ErrTotal:153 Final ErrRate:1.040
252+
```

0 commit comments

Comments
 (0)