aboutsummaryrefslogtreecommitdiffstats
path: root/src/particles
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@viroteck.net>2014-10-18 01:26:53 +0200
committerRobin Burchell <robin.burchell@viroteck.net>2014-10-20 13:13:59 +0200
commit66a476c0ff83f8ff70022e98c5a0595888d6801b (patch)
tree7ec381ea46b52c355595bab4d59728f623dbfdfd /src/particles
parente0321c352e288a8dd6c5dad17d7917c9534ad156 (diff)
QQuickParticleSystem: Optimize hash manipulation.
Before even checking the hash, perform the fast (empty string) check. If it's not empty, then do a single hash lookup, not two of them. There's no point doing a second lookup, since if it doesn't exist, we insert anyway. This takes hash manipulation on samegame on a large screen from ~142ms to ~70ms, which is expected. Change-Id: I4e2a099e996f2f5fb95a5b066d7756373a1dbacd Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/particles')
-rw-r--r--src/particles/qquickparticlesystem.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/particles/qquickparticlesystem.cpp b/src/particles/qquickparticlesystem.cpp
index 79d88ee601..86445ef498 100644
--- a/src/particles/qquickparticlesystem.cpp
+++ b/src/particles/qquickparticlesystem.cpp
@@ -922,8 +922,8 @@ void QQuickParticleSystem::emittersChanged()
}
foreach (QQuickParticleEmitter* e, m_emitters) {//Populate groups and set sizes.
- if (!groupIds.contains(e->group())
- || (!e->group().isEmpty() && !groupIds[e->group()])) {//or it was accidentally inserted by a failed lookup earlier
+ if (!e->group().isEmpty() &&
+ !groupIds.contains(e->group())) {
int id = m_nextGroupId++;
QQuickParticleGroupData* gd = new QQuickParticleGroupData(id, this);
groupIds.insert(e->group(), id);