Refactor KDevHash to use boost::hash_combine approach internally.

Review Request #124539 - Created July 30, 2015 and submitted - Latest diff uploaded

Information
Milian Wolff
kdevplatform
8eb10a1...
Reviewers
kdevelop

Instead of hashing every byte of an integral type individually,
we leverage qHash and boost::hash_combine to create an overall
hash. The result should be just as good, as it's proven technology,
but the hash functions themselves become much faster. This is
demonstrated by the newly added benchmark.

Before:

********* Start testing of TestKDevHash *********
Config: Using QtTest library 5.5.0, Qt 5.5.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 5.1.0)
PASS   : TestKDevHash::initTestCase()
PASS   : TestKDevHash::benchHash_int()
RESULT : TestKDevHash::benchHash_int():
     0.075 msecs per iteration (total: 77, iterations: 1024)
PASS   : TestKDevHash::benchHash_uint()
RESULT : TestKDevHash::benchHash_uint():
     0.075 msecs per iteration (total: 77, iterations: 1024)
PASS   : TestKDevHash::benchHash_quint64()
RESULT : TestKDevHash::benchHash_quint64():
     0.15 msecs per iteration (total: 77, iterations: 512)
PASS   : TestKDevHash::benchHash_bool()
RESULT : TestKDevHash::benchHash_bool():
     0.018 msecs per iteration (total: 77, iterations: 4096)
PASS   : TestKDevHash::cleanupTestCase()
Totals: 6 passed, 0 failed, 0 skipped, 0 blacklisted
********* Finished testing of TestKDevHash *********

After:

********* Start testing of TestKDevHash *********
Config: Using QtTest library 5.5.0, Qt 5.5.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 5.1.0)
PASS   : TestKDevHash::initTestCase()
PASS   : TestKDevHash::benchHash_int()
RESULT : TestKDevHash::benchHash_int():
     0.0244 msecs per iteration (total: 100, iterations: 4096)
PASS   : TestKDevHash::benchHash_uint()
RESULT : TestKDevHash::benchHash_uint():
     0.024 msecs per iteration (total: 99, iterations: 4096)
PASS   : TestKDevHash::benchHash_quint64()
RESULT : TestKDevHash::benchHash_quint64():
     0.025 msecs per iteration (total: 53, iterations: 2048)
PASS   : TestKDevHash::benchHash_bool()
RESULT : TestKDevHash::benchHash_bool():
     0.020 msecs per iteration (total: 85, iterations: 4096)
PASS   : TestKDevHash::cleanupTestCase()
Totals: 6 passed, 0 failed, 0 skipped, 0 blacklisted
********* Finished testing of TestKDevHash *********

REVIEW: 124539

compiled and ran tests, everything seems to work fine

Loading...