dbms, ███████████: fixed performance issue [#CONV-2944].

This commit is contained in:
Alexey Milovidov 2012-09-22 02:49:28 +00:00
parent bbd4109f3a
commit c7a4df24be
2 changed files with 7 additions and 14 deletions

View File

@ -14,6 +14,8 @@
#include <DB/Columns/ColumnConst.h>
#include <DB/Functions/IFunction.h>
#include <stats/IntHash.h>
namespace DB
{
@ -63,13 +65,8 @@ struct IntHash32Impl
static UInt32 apply(UInt64 x)
{
x = (~x) + (x << 18);
x = x ^ ((x >> 31) | (x << 33));
x = x * 21;
x = x ^ ((x >> 11) | (x << 53));
x = x + (x << 6);
x = x ^ ((x >> 22) | (x << 42));
return x;
/// seed взят из /dev/urandom.
return intHash32<UInt64, 0x75D9543DE018BF45ULL>(x);
}
};

View File

@ -9,6 +9,8 @@
#include <Yandex/optimization.h>
#include <stats/IntHash.h>
#include <DB/Core/Types.h>
@ -42,13 +44,7 @@ template <> struct default_hash<UInt64>
{
size_t operator() (UInt64 key) const
{
key = (~key) + (key << 18);
key = key ^ ((key >> 31) | (key << 33));
key = key * 21;
key = key ^ ((key >> 11) | (key << 53));
key = key + (key << 6);
key = key ^ ((key >> 22) | (key << 42));
return key;
return intHash32<UInt64, 0>(key);
}
};