Skip to content

Commit

Permalink
promote Pearson B to GOOD
Browse files Browse the repository at this point in the history
  • Loading branch information
rurban committed May 10, 2021
1 parent 9b3a4a3 commit 6eb697f
Show file tree
Hide file tree
Showing 11 changed files with 2,443 additions and 317 deletions.
4 changes: 3 additions & 1 deletion Hashes.h
Original file line number Diff line number Diff line change
Expand Up @@ -1255,15 +1255,17 @@ void nmhash32_test ( const void * key, int len, uint32_t seed, void * out );
void nmhash32x_test ( const void * key, int len, uint32_t seed, void * out );

#ifdef HAVE_INT64
// objsize: ???
extern "C" {
#include "pearson_hash/pearsonb.h"
// objsize: 417b50-417dfb = 683
inline void pearsonb64_test ( const void * key, int len, uint32_t seed, void * out ) {
*(uint64_t*)out = pearsonb_hash_64 ((const uint8_t*)key, (size_t) len, (uint64_t) seed);
}
// objsize: 41a1f0-41a65e: 1134
inline void pearsonb128_test ( const void * key, int len, uint32_t seed, void * out ) {
pearsonb_hash_128 ((uint8_t*)out, (const uint8_t*)key, (size_t) len, (uint64_t) seed);
}
// 41a660-41a9ac: 844
inline void pearsonb256_test ( const void * key, int len, uint32_t seed, void * out ) {
pearsonb_hash_256 ((uint8_t*)out, (const uint8_t*)key, (size_t) len, (uint64_t) seed);
}
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ SMhasher
| [pearsonhash64](doc/pearsonhash64.txt) | 287.95 | 174.11 | 196.50 (1) | | Avalanche, Seed, SSSE3 only. broken MSVC |
| [pearsonhash128](doc/pearsonhash128.txt) | 287.95 | 171.72 | 194.61 (1) | | Avalanche, Seed, SSSE3 only. broken MSVC |
| [pearsonhash256](doc/pearsonhash256.txt) | 264.51 | 184.87 | 218.79 (0) | | Avalanche, Seed, SSSE3 only. broken MSVC |
| [pearsonbhash64](doc/pearsonbhash64.txt) | 1486.34 | 104.32 | 185.03 (2) | | Seed, Perlin |
| [pearsonbhash128](doc/pearsonbhash128.txt) | 1347.03 | 121.75 | 214.84 (2) | | Seed, Perlin |
| [pearsonbhash256](doc/pearsonbhash256.txt) | 998.65 | 161.85 | 528.97 (12)| | Seed, Perlin |
| [VHASH_32](doc/VHASH_32.txt) | 9404.99 | 77.01 | 250.57 (2) |1231 | sanity, Seed, MomentChi2 |
| [VHASH_64](doc/VHASH_64.txt) | 9392.39 | 74.72 | 227.92 (2) |1231 | sanity, Seed, Sparse |
| [farsh32](doc/farsh32.txt) | 14053.09 | 74.29 | 245.33 (3) | 944 | insecure: AppendedZeroes, collisions+bias, MomentChi2, LongNeighbors |
Expand Down Expand Up @@ -132,6 +129,9 @@ SMhasher
| [SipHash](doc/SipHash.txt) | 980.88 | 127.77 | 246.19 (4) |1071 | |
| [HalfSipHash](doc/HalfSipHash.txt) | 755.78 | 114.47 | 243.72 (4) | 700 | zeroes |
| [GoodOAAT](doc/GoodOAAT.txt) | 1052.00 | 71.62 | 192.19 (1) | 237 | |
| [pearsonbhash64](doc/pearsonbhash64.txt) | 1486.34 | 104.32 | 185.03 (2) | 683 | |
| [pearsonbhash128](doc/pearsonbhash128.txt) | 1347.03 | 121.75 | 214.84 (2) |1134 | |
| [pearsonbhash256](doc/pearsonbhash256.txt) | 998.90 | 167.05 | 261.29 (3) | 844 | |
| [prvhash64_64m](doc/prvhash64_64m.txt) | 2386.19 | 51.18 | 186.87 (1) | 349 | |
| [prvhash64_64](doc/prvhash64_64.txt) | 2375.72 | 51.61 | 190.97 (2) | 384 | |
| [prvhash64_128](doc/prvhash64_128.txt) | 2383.57 | 103.44 | 246.45 (1) | 718 | |
Expand Down
48 changes: 24 additions & 24 deletions doc/air.html
Original file line number Diff line number Diff line change
Expand Up @@ -609,30 +609,6 @@
<td align="left"> Avalanche, Seed, SSSE3 only. broken MSVC</td>
</tr>
<tr class="poor">
<td align="left"><a href="pearsonbhash64.txt">pearsonbhash64</a></td>
<td align="right">2321.28</td>
<td align="right">71.86</td>
<td align="right">390.69 (18)</td>
<td align="right"></td>
<td align="left"> Seed, Perlin</td>
</tr>
<tr class="poor">
<td align="left"><a href="pearsonbhash128.txt">pearsonbhash128</a></td>
<td align="right">2221.71</td>
<td align="right">79.17</td>
<td align="right">400.51 (20)</td>
<td align="right"></td>
<td align="left"> Seed, Perlin</td>
</tr>
<tr class="poor">
<td align="left"><a href="pearsonbhash256.txt">pearsonbhash256</a></td>
<td align="right">1850.94</td>
<td align="right">91.40</td>
<td align="right">414.29 (19)</td>
<td align="right"></td>
<td align="left"> Seed, Perlin</td>
</tr>
<tr class="poor">
<td align="left"><a href="VHASH_32.txt">VHASH_32</a></td>
<td align="right">7713.21</td>
<td align="right">68.96</td>
Expand Down Expand Up @@ -1025,6 +1001,30 @@
<td align="left"></td>
</tr>
<tr class="good">
<td align="left"><a href="pearsonbhash64.txt">pearsonbhash64</a></td>
<td align="right">2321.28</td>
<td align="right">71.86</td>
<td align="right">390.69 (18)</td>
<td align="right">683</td>
<td align="left"></td>
</tr>
<tr class="good">
<td align="left"><a href="pearsonbhash128.txt">pearsonbhash128</a></td>
<td align="right">2221.71</td>
<td align="right">79.17</td>
<td align="right">400.51 (20)</td>
<td align="right">1134</td>
<td align="left"></td>
</tr>
<tr class="good">
<td align="left"><a href="pearsonbhash256.txt">pearsonbhash256</a></td>
<td align="right">1850.94</td>
<td align="right">91.40</td>
<td align="right">414.29 (19)</td>
<td align="right">844</td>
<td align="left"></td>
</tr>
<tr class="good">
<td align="left"><a href="prvhash64_64m.txt">prvhash64_64m</a></td>
<td align="right">3848.16</td>
<td align="right">35.92</td>
Expand Down
48 changes: 24 additions & 24 deletions doc/i686.html
Original file line number Diff line number Diff line change
Expand Up @@ -497,30 +497,6 @@
<td align="left"><a href="../#problems">UB</a>, too many bad seeds, MSVC specific</td>
</tr>
<tr class="poor">
<td align="left"><a href="pearsonbhash64.txt">pearsonbhash64</a></td>
<td align="right">845.46</td>
<td align="right">185.49</td>
<td align="right">277.92 (1)</td>
<td align="right"></td>
<td align="left"> Seed, Perlin</td>
</tr>
<tr class="poor">
<td align="left"><a href="pearsonbhash128.txt">pearsonbhash128</a></td>
<td align="right">640.96</td>
<td align="right">238.74</td>
<td align="right">330.63 (3)</td>
<td align="right"></td>
<td align="left"> Seed, Perlin</td>
</tr>
<tr class="poor">
<td align="left"><a href="pearsonbhash256.txt">pearsonbhash256</a></td>
<td align="right">393.20</td>
<td align="right">395.52</td>
<td align="right">459.62 (1)</td>
<td align="right"></td>
<td align="left"> Seed, Perlin</td>
</tr>
<tr class="poor">
<td align="left"><a href="VHASH_32.txt">VHASH_32</a></td>
<td align="right">1197.22</td>
<td align="right">181.18</td>
Expand Down Expand Up @@ -913,6 +889,30 @@
<td align="left"></td>
</tr>
<tr class="good">
<td align="left"><a href="pearsonbhash64.txt">pearsonbhash64</a></td>
<td align="right">845.46</td>
<td align="right">185.49</td>
<td align="right">277.92 (1)</td>
<td align="right">683</td>
<td align="left"></td>
</tr>
<tr class="good">
<td align="left"><a href="pearsonbhash128.txt">pearsonbhash128</a></td>
<td align="right">640.96</td>
<td align="right">238.74</td>
<td align="right">330.63 (3)</td>
<td align="right">1134</td>
<td align="left"></td>
</tr>
<tr class="good">
<td align="left"><a href="pearsonbhash256.txt">pearsonbhash256</a></td>
<td align="right">393.20</td>
<td align="right">395.52</td>
<td align="right">459.62 (1)</td>
<td align="right">844</td>
<td align="left"></td>
</tr>
<tr class="good">
<td align="left"><a href="prvhash64_64m.txt">prvhash64_64m</a></td>
<td align="right">1412.90</td>
<td align="right">112.08</td>
Expand Down
144 changes: 71 additions & 73 deletions doc/pearsonbhash128.txt
Original file line number Diff line number Diff line change
@@ -1,67 +1,67 @@
-------------------------------------------------------------------------------
--- Testing pearsonbhash128 "Pearson block hash, 128-bit, low 64-bits part" GOOD
--- Testing pearsonbhash128 "Pearson block hash, 128-bit, low 64-bit" POOR

[[[ Sanity Tests ]]]

Verification value 0x824DA7ED ....... PASS
Verification value 0x6BEFE6EA ....... PASS
Running sanity check 1 .......... PASS
Running AppendedZeroesTest .......... PASS

[[[ Speed Tests ]]]

Bulk speed test - 262144-byte keys
Alignment 7 - 0.471 bytes/cycle - 1346.26 MiB/sec @ 3 ghz
Alignment 6 - 0.471 bytes/cycle - 1346.25 MiB/sec @ 3 ghz
Alignment 5 - 0.471 bytes/cycle - 1346.25 MiB/sec @ 3 ghz
Alignment 4 - 0.471 bytes/cycle - 1346.25 MiB/sec @ 3 ghz
Alignment 3 - 0.471 bytes/cycle - 1346.26 MiB/sec @ 3 ghz
Alignment 2 - 0.471 bytes/cycle - 1346.26 MiB/sec @ 3 ghz
Alignment 1 - 0.471 bytes/cycle - 1346.27 MiB/sec @ 3 ghz
Alignment 0 - 0.473 bytes/cycle - 1352.43 MiB/sec @ 3 ghz
Average - 0.471 bytes/cycle - 1347.03 MiB/sec @ 3 ghz

Small key speed test - 1-byte keys - 49.65 cycles/hash
Small key speed test - 2-byte keys - 66.60 cycles/hash
Small key speed test - 3-byte keys - 83.77 cycles/hash
Small key speed test - 4-byte keys - 101.00 cycles/hash
Small key speed test - 5-byte keys - 119.00 cycles/hash
Small key speed test - 6-byte keys - 135.00 cycles/hash
Small key speed test - 7-byte keys - 152.73 cycles/hash
Small key speed test - 8-byte keys - 50.00 cycles/hash
Small key speed test - 9-byte keys - 67.85 cycles/hash
Small key speed test - 10-byte keys - 84.98 cycles/hash
Small key speed test - 11-byte keys - 102.00 cycles/hash
Small key speed test - 12-byte keys - 119.15 cycles/hash
Small key speed test - 13-byte keys - 136.20 cycles/hash
Small key speed test - 14-byte keys - 153.50 cycles/hash
Small key speed test - 15-byte keys - 170.77 cycles/hash
Small key speed test - 16-byte keys - 67.00 cycles/hash
Small key speed test - 17-byte keys - 85.00 cycles/hash
Small key speed test - 18-byte keys - 102.25 cycles/hash
Small key speed test - 19-byte keys - 119.23 cycles/hash
Small key speed test - 20-byte keys - 137.00 cycles/hash
Small key speed test - 21-byte keys - 153.00 cycles/hash
Small key speed test - 22-byte keys - 170.92 cycles/hash
Small key speed test - 23-byte keys - 188.00 cycles/hash
Small key speed test - 24-byte keys - 84.00 cycles/hash
Small key speed test - 25-byte keys - 102.00 cycles/hash
Small key speed test - 26-byte keys - 119.00 cycles/hash
Small key speed test - 27-byte keys - 136.78 cycles/hash
Small key speed test - 28-byte keys - 153.98 cycles/hash
Small key speed test - 29-byte keys - 170.42 cycles/hash
Small key speed test - 30-byte keys - 188.00 cycles/hash
Small key speed test - 31-byte keys - 205.42 cycles/hash
Average 121.748 cycles/hash
Alignment 7 - 0.705 bytes/cycle - 2017.78 MiB/sec @ 3 ghz
Alignment 6 - 0.706 bytes/cycle - 2019.31 MiB/sec @ 3 ghz
Alignment 5 - 0.706 bytes/cycle - 2019.16 MiB/sec @ 3 ghz
Alignment 4 - 0.706 bytes/cycle - 2019.71 MiB/sec @ 3 ghz
Alignment 3 - 0.697 bytes/cycle - 1994.44 MiB/sec @ 3 ghz
Alignment 2 - 0.706 bytes/cycle - 2019.73 MiB/sec @ 3 ghz
Alignment 1 - 0.706 bytes/cycle - 2019.79 MiB/sec @ 3 ghz
Alignment 0 - 0.695 bytes/cycle - 1987.25 MiB/sec @ 3 ghz
Average - 0.703 bytes/cycle - 2012.15 MiB/sec @ 3 ghz

Small key speed test - 1-byte keys - 39.96 cycles/hash
Small key speed test - 2-byte keys - 50.99 cycles/hash
Small key speed test - 3-byte keys - 62.00 cycles/hash
Small key speed test - 4-byte keys - 73.82 cycles/hash
Small key speed test - 5-byte keys - 85.80 cycles/hash
Small key speed test - 6-byte keys - 96.55 cycles/hash
Small key speed test - 7-byte keys - 107.96 cycles/hash
Small key speed test - 8-byte keys - 40.00 cycles/hash
Small key speed test - 9-byte keys - 51.92 cycles/hash
Small key speed test - 10-byte keys - 62.91 cycles/hash
Small key speed test - 11-byte keys - 74.26 cycles/hash
Small key speed test - 12-byte keys - 85.49 cycles/hash
Small key speed test - 13-byte keys - 97.37 cycles/hash
Small key speed test - 14-byte keys - 108.46 cycles/hash
Small key speed test - 15-byte keys - 120.60 cycles/hash
Small key speed test - 16-byte keys - 51.74 cycles/hash
Small key speed test - 17-byte keys - 62.92 cycles/hash
Small key speed test - 18-byte keys - 74.00 cycles/hash
Small key speed test - 19-byte keys - 84.93 cycles/hash
Small key speed test - 20-byte keys - 97.24 cycles/hash
Small key speed test - 21-byte keys - 107.99 cycles/hash
Small key speed test - 22-byte keys - 119.85 cycles/hash
Small key speed test - 23-byte keys - 132.00 cycles/hash
Small key speed test - 24-byte keys - 62.96 cycles/hash
Small key speed test - 25-byte keys - 74.00 cycles/hash
Small key speed test - 26-byte keys - 85.46 cycles/hash
Small key speed test - 27-byte keys - 96.56 cycles/hash
Small key speed test - 28-byte keys - 108.24 cycles/hash
Small key speed test - 29-byte keys - 119.67 cycles/hash
Small key speed test - 30-byte keys - 130.59 cycles/hash
Small key speed test - 31-byte keys - 142.76 cycles/hash
Average 87.387 cycles/hash

[[[ 'Hashmap' Speed Tests ]]]

std::unordered_map
Init std HashMapTest: 764.744 cycles/op (479826 inserts, 1% deletions)
Running std HashMapTest: 650.368 cycles/op (4.9 stdv)
Init std HashMapTest: 881.431 cycles/op (479826 inserts, 1% deletions)
Running std HashMapTest: 705.687 cycles/op (16.6 stdv)

greg7mdp/parallel-hashmap
Init fast HashMapTest: 837.306 cycles/op (479826 inserts, 1% deletions)
Running fast HashMapTest: 480.549 cycles/op (4.5 stdv) ....... PASS
Init fast HashMapTest: 1079.890 cycles/op (479826 inserts, 1% deletions)
Running fast HashMapTest: 546.932 cycles/op (17.1 stdv) ....... PASS

[[[ Avalanche Tests ]]]

Expand Down Expand Up @@ -753,37 +753,35 @@ Testing distribution - Worst bias is the 15-bit window at bit 93 - 0.435%
[[[ Keyset 'Seed' Tests ]]]

Keyset 'Seed' - 5000000 keys
Testing collisions (128-bit) - Expected 0.0, actual 4999999 (136112946768375379225981996761088.00x) (4999999) !!!!!
Testing collisions (high 64-bit) - Expected 0.0, actual 4999999 (7378697629483.82x) (4999999) !!!!!
Testing collisions (high 32-bit) - Expected 2910.4, actual 4999999 (1717.99x) (4997089) !!!!!
Testing collisions (high 26-39 bits) - Worst is 39 bits: 4999999/22 (219902.33x) !!!!!
Testing collisions (high 12-bit) - Expected 4995904.0, actual 4999999 (1.00x) (4095)
Testing collisions (high 8-bit) - Expected 4999744.0, actual 4999999 (1.00x) (255)
Testing collisions (low 64-bit) - Expected 0.0, actual 4999999 (7378697629483.82x) (4999999) !!!!!
Testing collisions (low 32-bit) - Expected 2910.4, actual 4999999 (1717.99x) (4997089) !!!!!
Testing collisions (low 26-39 bits) - Worst is 39 bits: 4999999/22 (219902.33x) !!!!!
Testing collisions (low 12-bit) - Expected 4995904.0, actual 4999999 (1.00x) (4095)
Testing collisions (low 8-bit) - Expected 4999744.0, actual 4999999 (1.00x) (255)
Testing distribution - Worst bias is the 19-bit window at bit 0 - 100.000% !!!!!

*********FAIL*********
Testing collisions (128-bit) - Expected 0.0, actual 0 (0.00x)
Testing collisions (high 64-bit) - Expected 0.0, actual 0 (0.00x)
Testing collisions (high 32-bit) - Expected 2910.4, actual 2897 (1.00x) (-13)
Testing collisions (high 26-39 bits) - Worst is 30 bits: 11609/11641 (1.00x)
Testing collisions (high 12-bit) - Expected 4995904.0, actual 4995904 (1.00x)
Testing collisions (high 8-bit) - Expected 4999744.0, actual 4999744 (1.00x)
Testing collisions (low 64-bit) - Expected 0.0, actual 0 (0.00x)
Testing collisions (low 32-bit) - Expected 2910.4, actual 3003 (1.03x) (93)
Testing collisions (low 26-39 bits) - Worst is 39 bits: 31/22 (1.36x)
Testing collisions (low 12-bit) - Expected 4995904.0, actual 4995904 (1.00x)
Testing collisions (low 8-bit) - Expected 4999744.0, actual 4999744 (1.00x)
Testing distribution - Worst bias is the 19-bit window at bit 33 - 0.057%


[[[ Keyset 'PerlinNoise' Tests ]]]

Testing 16777216 coordinates (L2) :
Testing collisions (128-bit) - Expected 0.0, actual 16773120 (40554918104250545339783029194752.00x) (16773120) !!!!!
Testing collisions (high 64-bit) - Expected 0.0, actual 16773120 (2198486515680.01x) (16773120) !!!!!
Testing collisions (high 32-bit) - Expected 32768.0, actual 16773120 (511.88x) (16740353) !!!!!
Testing collisions (high 27-42 bits) - Worst is 42 bits: 16773120/31 (524160.03x) !!!!!
Testing collisions (high 12-bit) - Expected 16773120.0, actual 16774628 (1.00x) (1508)
Testing collisions (128-bit) - Expected 0.0, actual 0 (0.00x)
Testing collisions (high 64-bit) - Expected 0.0, actual 0 (0.00x)
Testing collisions (high 32-bit) - Expected 32768.0, actual 32506 (0.99x) (-261)
Testing collisions (high 27-42 bits) - Worst is 38 bits: 512/511 (1.00x)
Testing collisions (high 12-bit) - Expected 16773120.0, actual 16773120 (1.00x)
Testing collisions (high 8-bit) - Expected 16776960.0, actual 16776960 (1.00x)
Testing collisions (low 64-bit) - Expected 0.0, actual 16773120 (2198486515680.01x) (16773120) !!!!!
Testing collisions (low 32-bit) - Expected 32768.0, actual 16773120 (511.88x) (16740353) !!!!!
Testing collisions (low 27-42 bits) - Worst is 42 bits: 16773120/31 (524160.03x) !!!!!
Testing collisions (low 12-bit) - Expected 16773120.0, actual 16774630 (1.00x) (1510)
Testing collisions (low 64-bit) - Expected 0.0, actual 0 (0.00x)
Testing collisions (low 32-bit) - Expected 32768.0, actual 32749 (1.00x) (-18)
Testing collisions (low 27-42 bits) - Worst is 41 bits: 71/63 (1.11x)
Testing collisions (low 12-bit) - Expected 16773120.0, actual 16773120 (1.00x)
Testing collisions (low 8-bit) - Expected 16776960.0, actual 16776960 (1.00x)

*********FAIL*********

[[[ Diff 'Differential' Tests ]]]

Expand Down Expand Up @@ -1676,5 +1674,5 @@ Testing 0 internal secrets:


Input vcode 0x00000001, Output vcode 0x00000001, Result vcode 0x00000001
Verification value is 0x00000001 - Testing took 1581.439220 seconds
Verification value is 0x00000001 - Testing took 1668.600249 seconds
-------------------------------------------------------------------------------
Loading

1 comment on commit 6eb697f

@Logan007
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thank you!

Please sign in to comment.