]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Optimize error handling for SORT
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 5 Jun 2017 18:09:51 +0000 (21:09 +0300)
committerGitLab <gitlab@git.dovecot.net>
Mon, 5 Jun 2017 21:49:34 +0000 (00:49 +0300)
If a lot of mails have failed in a large mailbox, this check reduces the
CPU usage significantly.

src/lib-storage/index/index-sort-string.c

index af10434cca4c3fe29736876c62d74a3a60be39ec..35da830a5763d943381d92944fdd7adda3e45310 100644 (file)
@@ -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;