Review Request 111643: RFC: Use QHash for TypeSystem registry
Commit Hook
null at kde.org
Thu Jul 25 19:30:59 UTC 2013
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/111643/
-----------------------------------------------------------
(Updated July 25, 2013, 7:30 p.m.)
Status
------
This change has been marked as submitted.
Review request for KDevelop.
Description
-------
Use a QHash instead of a fixed-size QVector for the type system registry.
While this is of course slower, the impact is imo negleglible. The benchmark
shows that the TypeSystem becomes ~20% slower, but that is still nothing in
total compared to other parts of KDevelop which are actually much slower.
Thus, limiting the API in such a drastic way (only up to N types) is imo
not worth it. Instead we can take the small performance impact and improve
the performance elsewhere :)
Also note that to encounter a slowdown of ~1s one would need to call the TypeSystem
functions approx. 45 million times. Setting a counter breakpoint on TypeSystem::create
shows that it's being called less than one million times when loading my biggest KDevelop
session. So yeah, I think we can safely ignore this time impact and classify the existing
code as a premature optimization.
Diffs
-----
language/duchain/types/typeregister.h 4843eec
language/duchain/types/typeregister.cpp 90ed05f
Diff: http://git.reviewboard.kde.org/r/111643/diff/
Testing
-------
Before this patch:
PASS : TestDUChain::initTestCase()
RESULT : TestDUChain::benchTypeRegistry():"dataClassSize":
0.0000299 msecs per iteration (total: 299, iterations: 10000000)
RESULT : TestDUChain::benchTypeRegistry():"dynamicSize":
0.0000438 msecs per iteration (total: 438, iterations: 10000000)
RESULT : TestDUChain::benchTypeRegistry():"create":
0.0001276 msecs per iteration (total: 1,276, iterations: 10000000)
RESULT : TestDUChain::benchTypeRegistry():"isFactoryLoaded":
0.0000271 msecs per iteration (total: 271, iterations: 10000000)
RESULT : TestDUChain::benchTypeRegistry():"copy":
0.0001812 msecs per iteration (total: 1,812, iterations: 10000000)
RESULT : TestDUChain::benchTypeRegistry():"copyNonDynamic":
0.0000409 msecs per iteration (total: 409, iterations: 10000000)
RESULT : TestDUChain::benchTypeRegistry():"callDestructor":
0.0000306 msecs per iteration (total: 306, iterations: 10000000)
PASS : TestDUChain::benchTypeRegistry()
PASS : TestDUChain::cleanupTestCase()
Totals: 3 passed, 0 failed, 0 skipped
********* Finished testing of TestDUChain *********
Performance counter stats for './duchaintest benchTypeRegistry -iterations 10000000':
10077.560833 task-clock # 0.995 CPUs utilized
214 context-switches # 0.021 K/sec
36 cpu-migrations # 0.004 K/sec
171,631 page-faults # 0.017 M/sec
11,717,686,879 cycles # 1.163 GHz [83.35%]
3,725,598,695 stalled-cycles-frontend # 31.79% frontend cycles idle [83.32%]
1,212,888,069 stalled-cycles-backend # 10.35% backend cycles idle [66.74%]
19,470,323,749 instructions # 1.66 insns per cycle
# 0.19 stalled cycles per insn [83.36%]
5,693,920,745 branches # 565.010 M/sec [83.33%]
1,995,259 branch-misses # 0.04% of all branches [83.27%]
10.124920649 seconds time elapsed
After this patch:
PASS : TestDUChain::initTestCase()
RESULT : TestDUChain::benchTypeRegistry():"dataClassSize":
0.0000310 msecs per iteration (total: 310, iterations: 10000000)
RESULT : TestDUChain::benchTypeRegistry():"dynamicSize":
0.0000574 msecs per iteration (total: 574, iterations: 10000000)
RESULT : TestDUChain::benchTypeRegistry():"create":
0.0001497 msecs per iteration (total: 1,497, iterations: 10000000)
RESULT : TestDUChain::benchTypeRegistry():"isFactoryLoaded":
0.0000349 msecs per iteration (total: 349, iterations: 10000000)
RESULT : TestDUChain::benchTypeRegistry():"copy":
0.0001863 msecs per iteration (total: 1,863, iterations: 10000000)
RESULT : TestDUChain::benchTypeRegistry():"copyNonDynamic":
0.0000522 msecs per iteration (total: 522, iterations: 10000000)
RESULT : TestDUChain::benchTypeRegistry():"callDestructor":
0.0000480 msecs per iteration (total: 480, iterations: 10000000)
PASS : TestDUChain::benchTypeRegistry()
PASS : TestDUChain::cleanupTestCase()
Totals: 3 passed, 0 failed, 0 skipped
********* Finished testing of TestDUChain *********
Performance counter stats for './duchaintest benchTypeRegistry -iterations 10000000':
11514.425401 task-clock # 0.992 CPUs utilized
463 context-switches # 0.040 K/sec
65 cpu-migrations # 0.006 K/sec
171,639 page-faults # 0.015 M/sec
14,606,973,287 cycles # 1.269 GHz [83.36%]
5,286,680,376 stalled-cycles-frontend # 36.19% frontend cycles idle [83.24%]
2,277,868,635 stalled-cycles-backend # 15.59% backend cycles idle [66.67%]
21,485,714,055 instructions # 1.47 insns per cycle
# 0.25 stalled cycles per insn [83.29%]
6,111,305,415 branches # 530.752 M/sec [83.38%]
2,157,996 branch-misses # 0.04% of all branches [83.35%]
11.609370777 seconds time elapsed
Thanks,
Milian Wolff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20130725/fad21c87/attachment.html>
More information about the KDevelop-devel
mailing list