Updated test of string hashes [#CLICKHOUSE-3244].

This commit is contained in:
Alexey Milovidov 2017-08-22 00:59:27 +03:00 committed by alexey-milovidov
parent c34211e0c5
commit 4eb77e6628
2 changed files with 41 additions and 20 deletions

View File

@ -636,20 +636,20 @@ int main(int argc, char ** argv)
}
if (!m || m == 1) bench<StringRef_Compare1_Ptrs> (data, "StringRef_Compare1_Ptrs");
if (!m || m == 2) bench<StringRef_Compare1_Index> (data, "StringRef_Compare1_Index");
if (!m || m == 2) bench<StringRef_Compare1_Index> (data, "StringRef_Compare1_Index");
if (!m || m == 3) bench<StringRef_CompareMemcmp> (data, "StringRef_CompareMemcmp");
if (!m || m == 4) bench<StringRef_Compare8_1_byUInt64> (data, "StringRef_Compare8_1_byUInt64");
if (!m || m == 5) bench<StringRef_Compare16_1_byMemcmp> (data, "StringRef_Compare16_1_byMemcmp");
if (!m || m == 4) bench<StringRef_Compare8_1_byUInt64> (data, "StringRef_Compare8_1_byUInt64");
if (!m || m == 5) bench<StringRef_Compare16_1_byMemcmp> (data, "StringRef_Compare16_1_byMemcmp");
if (!m || m == 6) bench<StringRef_Compare16_1_byUInt64_logicAnd>(data, "StringRef_Compare16_1_byUInt64_logicAnd");
if (!m || m == 7) bench<StringRef_Compare16_1_byUInt64_bitAnd> (data, "StringRef_Compare16_1_byUInt64_bitAnd");
if (!m || m == 7) bench<StringRef_Compare16_1_byUInt64_bitAnd> (data, "StringRef_Compare16_1_byUInt64_bitAnd");
#if __SSE4_1__
if (!m || m == 8) bench<StringRef_Compare16_1_byIntSSE> (data, "StringRef_Compare16_1_byIntSSE");
if (!m || m == 9) bench<StringRef_Compare16_1_byFloatSSE> (data, "StringRef_Compare16_1_byFloatSSE");
if (!m || m == 10) bench<StringRef_Compare16_1_bySSE4> (data, "StringRef_Compare16_1_bySSE4");
if (!m || m == 11) bench<StringRef_Compare16_1_bySSE4_wide> (data, "StringRef_Compare16_1_bySSE4_wide");
if (!m || m == 12) bench<StringRef_Compare16_1_bySSE_wide> (data, "StringRef_Compare16_1_bySSE_wide");
if (!m || m == 8) bench<StringRef_Compare16_1_byIntSSE> (data, "StringRef_Compare16_1_byIntSSE");
if (!m || m == 9) bench<StringRef_Compare16_1_byFloatSSE> (data, "StringRef_Compare16_1_byFloatSSE");
if (!m || m == 10) bench<StringRef_Compare16_1_bySSE4> (data, "StringRef_Compare16_1_bySSE4");
if (!m || m == 11) bench<StringRef_Compare16_1_bySSE4_wide> (data, "StringRef_Compare16_1_bySSE4_wide");
if (!m || m == 12) bench<StringRef_Compare16_1_bySSE_wide> (data, "StringRef_Compare16_1_bySSE_wide");
#endif
if (!m || m == 100) bench<StringRef_CompareAlwaysTrue> (data, "StringRef_CompareAlwaysTrue");
if (!m || m == 100) bench<StringRef_CompareAlwaysTrue> (data, "StringRef_CompareAlwaysTrue");
if (!m || m == 101) bench<StringRef_CompareAlmostAlwaysTrue> (data, "StringRef_CompareAlmostAlwaysTrue");
/// 10 > 8, 9

View File

@ -139,6 +139,26 @@ struct FastHash64
};
struct FNV1a
{
size_t operator() (StringRef x) const
{
size_t res = 0xcbf29ce484222325ULL;
const char * pos = x.data;
const char * end = x.data + x.size;
for (; pos < end; ++pos)
{
res *= 1099511628211ULL;
res ^= *pos;
}
return res;
}
};
#if __SSE4_1__
struct CrapWow
@ -462,20 +482,21 @@ int main(int argc, char ** argv)
<< std::endl;
}
if (!m || m == 1) bench<StringRef_CompareMemcmp, StringRefHash64>(data, "StringRef_CityHash64");
if (!m || m == 2) bench<StringRef_CompareMemcmp, FastHash64> (data, "StringRef_FastHash64");
if (!m || m == 3) bench<StringRef_CompareMemcmp, SimpleHash> (data, "StringRef_SimpleHash");
if (!m || m == 1) bench<StringRef, StringRefHash64>(data, "StringRef_CityHash64");
if (!m || m == 2) bench<StringRef, FastHash64> (data, "StringRef_FastHash64");
if (!m || m == 3) bench<StringRef, SimpleHash> (data, "StringRef_SimpleHash");
if (!m || m == 3) bench<StringRef, FNV1a> (data, "StringRef_FNV1a");
#if __SSE4_1__
if (!m || m == 4) bench<StringRef_CompareMemcmp, CrapWow> (data, "StringRef_CrapWow");
if (!m || m == 5) bench<StringRef_CompareMemcmp, CRC32Hash> (data, "StringRef_CRC32Hash");
if (!m || m == 6) bench<StringRef_CompareMemcmp, CRC32ILPHash> (data, "StringRef_CRC32ILPHash");
if (!m || m == 4) bench<StringRef, CrapWow> (data, "StringRef_CrapWow");
if (!m || m == 5) bench<StringRef, CRC32Hash> (data, "StringRef_CRC32Hash");
if (!m || m == 6) bench<StringRef, CRC32ILPHash> (data, "StringRef_CRC32ILPHash");
#endif
if (!m || m == 7) bench<StringRef_CompareMemcmp, VerySimpleHash>(data, "StringRef_VerySimpleHash");
if (!m || m == 8) bench<StringRef_CompareMemcmp, FarmHash64>(data, "StringRef_FarmHash64");
if (!m || m == 9) bench<StringRef_CompareMemcmp, MetroHash64<metrohash64_1>>(data, "StringRef_MetroHash64_1");
if (!m || m == 10) bench<StringRef_CompareMemcmp, MetroHash64<metrohash64_2>>(data, "StringRef_MetroHash64_2");
if (!m || m == 7) bench<StringRef, VerySimpleHash> (data, "StringRef_VerySimpleHash");
if (!m || m == 8) bench<StringRef, FarmHash64> (data, "StringRef_FarmHash64");
if (!m || m == 9) bench<StringRef, MetroHash64<metrohash64_1>>(data, "StringRef_MetroHash64_1");
if (!m || m == 10) bench<StringRef, MetroHash64<metrohash64_2>>(data, "StringRef_MetroHash64_2");
return 0;
}