dovecot-2.2: mail-index: Preparatory HACK - reverse the loop ord...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jun 2 11:53:50 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/b4c630542488
changeset: 17424:b4c630542488
user:      Phil Carmody <phil at dovecot.fi>
date:      Mon Jun 02 14:50:34 2014 +0300
description:
mail-index: Preparatory HACK - reverse the loop order in the expunge
This is the final step before the actual optimisation of the memmoves.

HACK, as it it de-optimises the moves so as much as possible gets moved
as many times as possible. It clears the path for a later patch which
optimises them far better.

Based on draft patch by Timo Sirainen.

Signed-off-by: Phil Carmody <phil at dovecot.fi>

diffstat:

 src/lib-index/mail-index-sync-update.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (18 lines):

diff -r 74a726930ca8 -r b4c630542488 src/lib-index/mail-index-sync-update.c
--- a/src/lib-index/mail-index-sync-update.c	Mon Jun 02 14:50:34 2014 +0300
+++ b/src/lib-index/mail-index-sync-update.c	Mon Jun 02 14:50:34 2014 +0300
@@ -254,10 +254,10 @@
 		}
 	}
 
-	/* do this in reverse so the memmove()s are smaller */
-	for (i = count; i > 0; i--) {
-		uint32_t seq1 = range[i-1].seq1;
-		uint32_t seq2 = range[i-1].seq2;
+	/* Preparatory HACK - do this in forward order so the memmove()s are pessimal! */
+	for (i = 0; i < count; i++) {
+		uint32_t seq1 = range[i].seq1;
+		uint32_t seq2 = range[i].seq2;
 		struct mail_index_record *rec;
 		uint32_t seq_count, seq;
 


More information about the dovecot-cvs mailing list