]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mail-index: Preparatory HACK - reverse the loop order in the expunge
authorPhil Carmody <phil@dovecot.fi>
Mon, 2 Jun 2014 11:50:34 +0000 (14:50 +0300)
committerPhil Carmody <phil@dovecot.fi>
Mon, 2 Jun 2014 11:50:34 +0000 (14:50 +0300)
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@dovecot.fi>
src/lib-index/mail-index-sync-update.c

index 6b7b112e9d38469693cf309fdb889c5723c922f7..5248cb2683fb3e2d23715ed9e5c586a1e5b8b306 100644 (file)
@@ -254,10 +254,10 @@ sync_expunge_range(struct mail_index_sync_map_ctx *ctx, const ARRAY_TYPE(seq_ran
                }
        }
 
-       /* 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;