From: Timo Sirainen Date: Mon, 5 Jun 2017 18:09:51 +0000 (+0300) Subject: lib-storage: Optimize error handling for SORT X-Git-Tag: 2.3.0.rc1~1513 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0a6a527f0c42b5478d80ac53ab357885676fd516;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Optimize error handling for SORT If a lot of mails have failed in a large mailbox, this check reduces the CPU usage significantly. --- diff --git a/src/lib-storage/index/index-sort-string.c b/src/lib-storage/index/index-sort-string.c index af10434cca..35da830a57 100644 --- a/src/lib-storage/index/index-sort-string.c +++ b/src/lib-storage/index/index-sort-string.c @@ -355,6 +355,11 @@ index_sort_get_string(struct sort_string_context *ctx, uint32_t seq = node->seq; int ret = 1; + if (node->no_update) { + /* we've already determined that we can't do this lookup */ + return FALSE; + } + if (ctx->sort_strings[seq] == NULL) T_BEGIN { string_t *str; const char *result;