summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2019-10-18 14:35:40 +0200
committerPaul Lemire <paul.lemire@kdab.com>2019-11-14 06:37:38 +0100
commit50db67eb310fba162f73ac6fdf28a8457ce50b21 (patch)
tree788a6e72aac7ea848c443b6db4f25eb5215ef05d /tests
parent38a3ceef605fb337066e441a4afeb4e460e6a26c (diff)
PackUniformHash to QVector
Surprisingly it's hard to notice its effect in the speed of execution, frame preparation looks to be more or less the same with the profiler. However with vtune, the profiling traces show a huge difference with QHash, mainly in time spent allocating memory. It shows a noticeable reduction in CPU usage. On bigscene-cpp with 600 entities QHash -> On a 158s run, CPU time is 112s (70%) free accounts for 26s (23%), malloc 24s (21%) QVector -> On a 190s run, CPU time is 110s (58%) free accounts for 5s (4.5%), malloc 4.7s (4.2%) Change-Id: I880d44b1acf7f051e479ed356864c3caf407f23f Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/render/renderviews/tst_renderviews.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/tests/auto/render/renderviews/tst_renderviews.cpp b/tests/auto/render/renderviews/tst_renderviews.cpp
index 17995659b..1558b68c9 100644
--- a/tests/auto/render/renderviews/tst_renderviews.cpp
+++ b/tests/auto/render/renderviews/tst_renderviews.cpp
@@ -51,16 +51,11 @@ void compareShaderParameterPacks(const ShaderParameterPack &t1,
const PackUniformHash hash1 = t1.uniforms();
const PackUniformHash hash2 = t2.uniforms();
- QCOMPARE(hash1.size(), hash2.size());
+ QCOMPARE(hash1.keys.size(), hash2.keys.size());
- auto it = hash1.constBegin();
- const auto end = hash1.constEnd();
-
- while (it != end) {
- const auto h2It = hash2.find(it.key());
- QVERIFY(h2It != hash2.cend());
- QCOMPARE(it.value(), h2It.value());
- ++it;
+ for (int i = 0, m = hash1.keys.size(); i < m; ++i) {
+ const int key = hash1.keys.at(i);
+ QCOMPARE(hash1.value(key), hash2.value(key));
}
}