1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
#include <stdio.h>
#include <time.h>
#include "hashes.h"
#include "tests.h"
#include <windows.h>
#pragma warning(disable:4702)
//----------------------------------------------------------------------------
template < typename hashtype >
void test ( hashfunc<hashtype> hash, const char * hashname )
{
printf("Testing %s\n",hashname);
//const int hbytes = sizeof(hashtype);
//const int hbits = hbytes * 8;
TwiddleTest(hash);
AlignmentTest(hash);
AppendedZeroesTest(hash);
QuickBrownFox(hash);
printf("\n");
BulkSpeedTest(hash);
TinySpeedTest<hashtype,4>(hash);
TinySpeedTest<hashtype,5>(hash);
TinySpeedTest<hashtype,6>(hash);
TinySpeedTest<hashtype,7>(hash);
TinySpeedTest<hashtype,8>(hash);
TinySpeedTest<hashtype,256>(hash);
printf("\n");
// # of bytes in the cycle must be at least # of bytes in the hash output
//CycleTest<hashtype>(hash,sizeof(hashtype)+0,8,10000000);
//CycleTest<hashtype>(hash,sizeof(hashtype)+1,8,10000000);
//CycleTest<hashtype>(hash,sizeof(hashtype)+2,8,10000000);
//CycleTest<hashtype>(hash,sizeof(hashtype)+3,8,10000000);
//CycleTest<hashtype>(hash,sizeof(hashtype)+4,8,10000000);
printf("\n");
/*
DiffTest< Blob<64>, hashtype >(hash,5,1000);
DiffTest< Blob<128>, hashtype >(hash,4,1000);
DiffTest< Blob<256>, hashtype >(hash,3,1000);
printf("\n");
AvalancheTest(hash);
*/
SparseKeyTest(hash,false);
//DictionaryTest(hash);
//BitrangeKeysetTest(hash,false);
//TextKeyTest(hash.m_hash);
}
//-----------------------------------------------------------------------------
void optimize_fmix64 ( void );
void main ( void )
{
SetProcessAffinityMask(GetCurrentProcess(),2);
int a = clock();
#if 0
optimize_fmix64();
//scratchmain();
#else
//----------
//test<uint32_t> ( md5_32, "MD5, first 32 bits" );
//test<uint32_t> ( lookup3_test, "Jenkins lookup3" );
//test<uint32_t> ( SuperFastHash, "SuperFastHash" );
//test<uint32_t> ( MurmurHash2_test, "MurmurHash2 32-bit" );
//test<uint32_t> ( MurmurHash2A_test, "MurmurHash2 32-bit" );
//test<uint32_t> ( FNV, "FNV 32-bit" );
//test<uint32_t> ( crc32, "CRC-32" );
//test<uint32_t> ( DoNothingHash, "MurmurHash3 32-bit" );
//test<uint32_t> ( MurmurHash3_x86_32, "MurmurHash3 32-bit" );
test<uint64_t> ( MurmurHash3_x86_64, "MurmurHash3 64-bit" );
//test<k128> ( MurmurHash3_128, "MurmurHash3 128-bit" );
//test<uint32_t> ( MurmurHash3x64_32, "MurmurHash3 32-bit" );
#endif
int b = clock();
printf("time %d\n",b-a);
}
|