Skip to content

Commit 651d4cc

Browse files
author
Ivan Tikhonov
committed
1024
1 parent 2389c16 commit 651d4cc

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

IT.Hashing.Benchmarks/Hash.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class HashBenchmark
1818
private static readonly Random _random = new();
1919
private byte[] _bytes = null!;
2020

21-
[Params(1024 * 1024)]
21+
[Params(1024)]
2222
public int Length { get; set; }
2323

2424
[GlobalSetup]
@@ -71,7 +71,7 @@ public byte[] IT_Bytes_CRC32()
7171
public ulong ST_UInt32_XXH32() => Standart.Hash.xxHash.xxHash32.ComputeHash(_bytes);
7272
#endif
7373

74-
[Benchmark]
74+
//[Benchmark]
7575
public byte[] IT_Bytes_XXH32()
7676
{
7777
var hash = new byte[4];
@@ -81,7 +81,7 @@ public byte[] IT_Bytes_XXH32()
8181
return hash;
8282
}
8383

84-
[Benchmark]
84+
//[Benchmark]
8585
public byte[] IO_Bytes_XXH32() => System.IO.Hashing.XxHash32.Hash(_bytes);
8686

8787
#endregion XXH32
@@ -100,7 +100,7 @@ public byte[] IT_Bytes_XXH32()
100100
public ulong ST_UInt64_XXH64() => Standart.Hash.xxHash.xxHash64.ComputeHash(_bytes);
101101
#endif
102102

103-
[Benchmark]
103+
//[Benchmark]
104104
public byte[] IT_Bytes_XXH64()
105105
{
106106
var hash = new byte[8];
@@ -110,7 +110,7 @@ public byte[] IT_Bytes_XXH64()
110110
return hash;
111111
}
112112

113-
[Benchmark]
113+
//[Benchmark]
114114
public byte[] IO_Bytes_XXH64() => System.IO.Hashing.XxHash64.Hash(_bytes);
115115

116116
#endregion XXH64
@@ -122,6 +122,9 @@ public byte[] IT_Bytes_XXH64()
122122

123123
#if NET6_0_OR_GREATER
124124

125+
/// <summary>
126+
/// Win!!
127+
/// </summary>
125128
[Benchmark]
126129
public ulong ST_UInt64_XXH3() => Standart.Hash.xxHash.xxHash3.ComputeHash(_bytes, _bytes.Length);
127130
#endif

IT.Hashing.Benchmarks/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
var bench = new HashBenchmark();
44

5-
bench.Length = 100;
5+
bench.Length = 1024;
66

77
bench.Setup();
88

0 commit comments

Comments
 (0)