From 202ffa522668087cc133026febf21a7de8963218 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Mon, 1 Dec 2014 11:51:04 +0100 Subject: [PATCH 17/30] Optimize: Only do one hash lookup to retrieve value from cache. Compilers do not merge the call to contains() and the successive value() lookup. Using iterators thus saves us one QHash lookup. --- server/src/storage/entities.xsl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/src/storage/entities.xsl b/server/src/storage/entities.xsl index a397544..9471293 100644 --- a/server/src/storage/entities.xsl +++ b/server/src/storage/entities.xsl @@ -168,9 +168,9 @@ set( ) if ( Private::cacheEnabled ) { QMutexLocker lock(&Private::cacheMutex); - if ( Private::.contains( ) ) { - const tmp = Private::.value( ); - return tmp; + QHash<, >::const_iterator it = Private::.constFind(); + if ( it != Private::.constEnd() ) { + return it.value(); } } -- 2.1.0