QHash vs. unordered_map

Łukasz Kucharski lukasz.kucharski at nsn.com
Thu Nov 22 07:12:52 UTC 2012


Hi,

$ build/language/duchain/tests/itemrepositorytest.shell testStringHashPerformance
********* Start testing of TestItemRepository *********
Config: Using QTest library 4.8.2, Qt 4.8.2
QDEBUG : TestItemRepository::initTestCase() KGlobal::locale::Warning your global KLocale is being recreated with a valid main component instead of a fake component, this usually means you tried to call i18n related functions before your main component was created. You should not do that since it most likely will not work
PASS   : TestItemRepository::initTestCase()
RESULT : TestItemRepository::testStringHashPerformance():"unordered_map-100":
      0.017 msecs per iteration (total: 72, iterations: 4096)
RESULT : TestItemRepository::testStringHashPerformance():"unordered_map-1000":
      0.16 msecs per iteration (total: 82, iterations: 512)
RESULT : TestItemRepository::testStringHashPerformance():"unordered_map-10000":
      1.6 msecs per iteration (total: 52, iterations: 32)
RESULT : TestItemRepository::testStringHashPerformance():"unordered_map-100000":
      20 msecs per iteration (total: 81, iterations: 4)
RESULT : TestItemRepository::testStringHashPerformance():"qhash-100":
      0.012 msecs per iteration (total: 52, iterations: 4096)
RESULT : TestItemRepository::testStringHashPerformance():"qhash-1000":
      0.12 msecs per iteration (total: 64, iterations: 512)
RESULT : TestItemRepository::testStringHashPerformance():"qhash-10000":
      1.3 msecs per iteration (total: 88, iterations: 64)
RESULT : TestItemRepository::testStringHashPerformance():"qhash-100000":
      17 msecs per iteration (total: 69, iterations: 4)
PASS   : TestItemRepository::testStringHashPerformance()
PASS   : TestItemRepository::cleanupTestCase()
Totals: 3 passed, 0 failed, 0 skipped
********* Finished testing of TestItemRepository *********

$ uname -a
Linux 3.3.8-gentoo #2 SMP Wed Jul 11 14:44:18 CEST 2012 x86_64 Intel(R) Core(TM) i5 CPU M 560 @ 2.67GHz GenuineIntel GNU/Linux


Dnia 21-11-2012 o 20:15:58 ext Milian Wolff <mail at milianw.de> napisał(a):

> Hey all,
>
> can you please share the numbers for a release build running the following
> test from KDevplatform:
>
> language/duchain/tests/itemrepositorytest.shell testStringHashPerformance
>
> See 7465cc39f13edc4a4e99cf033a5751c8339018e0 for my numbers. If people can
> confirm this, then I'll refactor our code to use QHash and drop the nasty
> ifdef code.
>
> Cheers
>
> PS: Looking at the usage of hash_map in KDevelop's cpp parser, I'd say that
> its just overdesigned and could also easily be using a QHash.




More information about the KDevelop-devel mailing list