dovecot-2.0: lib-index: Optimized handling MAIL_TRANSACTION_EXPU...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Aug 16 22:27:30 EEST 2011
details: http://hg.dovecot.org/dovecot-2.0/rev/17d7aceda8ba
changeset: 12876:17d7aceda8ba
user: Timo Sirainen <tss at iki.fi>
date: Tue Aug 16 22:27:18 2011 +0300
description:
lib-index: Optimized handling MAIL_TRANSACTION_EXPUNGE_GUID records in large index.
diffstat:
src/lib-index/mail-index-sync-update.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diffs (34 lines):
diff -r ba03935cc599 -r 17d7aceda8ba src/lib-index/mail-index-sync-update.c
--- a/src/lib-index/mail-index-sync-update.c Thu Aug 04 19:57:35 2011 +0300
+++ b/src/lib-index/mail-index-sync-update.c Tue Aug 16 22:27:18 2011 +0300
@@ -552,11 +552,15 @@
case MAIL_TRANSACTION_EXPUNGE_GUID:
case MAIL_TRANSACTION_EXPUNGE_GUID|MAIL_TRANSACTION_EXPUNGE_PROT: {
const struct mail_transaction_expunge_guid *rec = data, *end;
+ ARRAY_TYPE(seq_range) uids;
+ const struct seq_range *range;
+ unsigned int i, count;
if ((hdr->type & MAIL_TRANSACTION_EXTERNAL) == 0) {
/* this is simply a request for expunge */
break;
}
+ t_array_init(&uids, 64);
end = CONST_PTR_OFFSET(data, hdr->size);
for (; rec != end; rec++) {
if (rec->uid == 0) {
@@ -565,8 +569,13 @@
rec->uid);
break;
}
- sync_expunge(ctx, rec->uid, rec->uid);
+ seq_range_array_add(&uids, 0, rec->uid);
}
+
+ /* do this in reverse so the memmove()s are smaller */
+ range = array_get(&uids, &count);
+ for (i = count; i > 0; i--)
+ sync_expunge(ctx, range[i-1].seq1, range[i-1].seq2);
break;
}
case MAIL_TRANSACTION_FLAG_UPDATE: {
More information about the dovecot-cvs
mailing list