]> git.pld-linux.org Git - packages/akonadi.git/blob - 0017-Optimize-Only-do-one-hash-lookup-to-retrieve-value-f.patch
boost rebuild
[packages/akonadi.git] / 0017-Optimize-Only-do-one-hash-lookup-to-retrieve-value-f.patch
1 From 202ffa522668087cc133026febf21a7de8963218 Mon Sep 17 00:00:00 2001
2 From: Milian Wolff <mail@milianw.de>
3 Date: Mon, 1 Dec 2014 11:51:04 +0100
4 Subject: [PATCH 17/30] Optimize: Only do one hash lookup to retrieve value
5  from cache.
6
7 Compilers do not merge the call to contains() and the successive
8 value() lookup. Using iterators thus saves us one QHash lookup.
9 ---
10  server/src/storage/entities.xsl | 6 +++---
11  1 file changed, 3 insertions(+), 3 deletions(-)
12
13 diff --git a/server/src/storage/entities.xsl b/server/src/storage/entities.xsl
14 index a397544..9471293 100644
15 --- a/server/src/storage/entities.xsl
16 +++ b/server/src/storage/entities.xsl
17 @@ -168,9 +168,9 @@ set<xsl:value-of select="$methodName"/>( <xsl:call-template name="argument"/> )
18    <xsl:if test="$cache != ''">
19    if ( Private::cacheEnabled ) {
20      QMutexLocker lock(&amp;Private::cacheMutex);
21 -    if ( Private::<xsl:value-of select="$cache"/>.contains( <xsl:value-of select="$key"/> ) ) {
22 -      const <xsl:value-of select="$className"/> tmp = Private::<xsl:value-of select="$cache"/>.value( <xsl:value-of select="$key"/> );
23 -      return tmp;
24 +    QHash&lt;<xsl:value-of select="column[@name = $key]/@type"/>, <xsl:value-of select="$className"/>&gt;::const_iterator it = Private::<xsl:value-of select="$cache"/>.constFind(<xsl:value-of select="$key"/>);
25 +    if ( it != Private::<xsl:value-of select="$cache"/>.constEnd() ) {
26 +      return it.value();
27      }
28    }
29    </xsl:if>
30 -- 
31 2.1.0
32
This page took 0.111627 seconds and 3 git commands to generate.