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