Review Request 124539: Refactor KDevHash to use boost::hash_combine approach internally.

Milian Wolff mail at milianw.de
Wed Aug 12 08:43:36 UTC 2015



> On Aug. 2, 2015, 6:17 p.m., Kevin Funk wrote:
> > language/util/kdevhash.h, line 45
> > <https://git.reviewboard.kde.org/r/124539/diff/2/?file=389406#file389406line45>
> >
> >     const&?
> 
> Olivier Jean de Gaalon wrote:
>     Hmm, this should always be integral, so we don't want that, but it would be nice to disable non-integral types.
> 
> Kevin Funk wrote:
>     Right, sorry, indeed doesn't make sense here. I falsely assumed KDevHash was being used for non-integral types, too (bad grep through source code).

note that this will be inlined anyways (or so I hope). the compiler should be smart enough to make this fast


- Milian


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/124539/#review83340
-----------------------------------------------------------


On Aug. 2, 2015, 2:16 p.m., Milian Wolff wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/124539/
> -----------------------------------------------------------
> 
> (Updated Aug. 2, 2015, 2:16 p.m.)
> 
> 
> Review request for KDevelop.
> 
> 
> Repository: kdevplatform
> 
> 
> Description
> -------
> 
> 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
> 
> 
> Diffs
> -----
> 
>   CMakeLists.txt 70174433c9d9b88595254887c4f06c12aa7043e0 
>   language/CMakeLists.txt 2c2b0285b68d209e07af185c43dcf157507f5a54 
>   language/util/kdevhash.h 40c32935aec9c7e5552769e780c033e96cf63166 
>   language/util/tests/CMakeLists.txt PRE-CREATION 
>   language/util/tests/test_kdevhash.cpp PRE-CREATION 
>   plugins/projectfilter/projectfilter.h 014e5a1eabbb3a2d9e71baeee3e38643cb8649e7 
>   serialization/tests/test_indexedstring.cpp f0c7958ac33c6fc6c4febbaa106e0ca30f8a60f8 
> 
> Diff: https://git.reviewboard.kde.org/r/124539/diff/
> 
> 
> Testing
> -------
> 
> compiled and ran tests, everything seems to work fine
> 
> 
> Thanks,
> 
> Milian Wolff
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20150812/e70fc5e2/attachment-0001.html>


More information about the KDevelop-devel mailing list