diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2019-10-18 14:35:40 +0200 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2019-11-14 06:37:38 +0100 |
commit | 50db67eb310fba162f73ac6fdf28a8457ce50b21 (patch) | |
tree | 788a6e72aac7ea848c443b6db4f25eb5215ef05d /src/render/materialsystem/shader.cpp | |
parent | 38a3ceef605fb337066e441a4afeb4e460e6a26c (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 'src/render/materialsystem/shader.cpp')
-rw-r--r-- | src/render/materialsystem/shader.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/render/materialsystem/shader.cpp b/src/render/materialsystem/shader.cpp index 017deabac..300a71b84 100644 --- a/src/render/materialsystem/shader.cpp +++ b/src/render/materialsystem/shader.cpp @@ -244,13 +244,13 @@ void Shader::prepareUniforms(ShaderParameterPack &pack) { const PackUniformHash &values = pack.uniforms(); - auto it = values.cbegin(); - const auto end = values.cend(); + auto it = values.keys.cbegin(); + const auto end = values.keys.cend(); while (it != end) { // Find if there's a uniform with the same name id for (const ShaderUniform &uniform : qAsConst(m_uniforms)) { - if (uniform.m_nameId == it.key()) { + if (uniform.m_nameId == *it) { pack.setSubmissionUniform(uniform); break; } |