[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdepimlibs/KDE/4.9] kmbox: Speed up this method for the common case.
From:       David Faure <faure () kde ! org>
Date:       2012-06-30 14:21:40
Message-ID: 20120630142140.6793AA60A6 () git ! kde ! org
[Download RAW message or body]

Git commit 9c8a1157d30f34faec68e199e97ab99dc0893336 by David Faure.
Committed on 30/06/2012 at 16:00.
Pushed by dfaure into branch 'KDE/4.9'.

Speed up this method for the common case.

No need to copy the list item by item, when no filtering is happening.

M  +5    -0    kmbox/mbox.cpp

http://commits.kde.org/kdepimlibs/9c8a1157d30f34faec68e199e97ab99dc0893336

diff --git a/kmbox/mbox.cpp b/kmbox/mbox.cpp
index f5eb5a2..68a355c 100644
--- a/kmbox/mbox.cpp
+++ b/kmbox/mbox.cpp
@@ -122,6 +122,11 @@ MBoxEntry MBox::appendMessage( const KMime::Message::P=
tr &entry )
 =

 MBoxEntry::List MBox::entries( const MBoxEntry::List &deletedEntries ) con=
st
 {
+  if ( deletedEntries.isEmpty() ) {
+    // fast path
+    return d->mEntries;
+  }
+
   MBoxEntry::List result;
 =

   foreach ( const MBoxEntry &entry, d->mEntries ) {
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic