From 8f4af5f78f118f2e508ca1af7e30d20a3dae8cae Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 29 Dec 2021 22:38:50 +0100 Subject: [PATCH] make use of finduid[] after journal replay we used to pass all initially loaded messages to match_tuids(), which could be quite some when syncing old messages. as lost TUIDs result in O(n^2) behavior, this could have a serious performance impact. --- src/sync.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sync.c b/src/sync.c index 62c48a6..d0dd056 100644 --- a/src/sync.c +++ b/src/sync.c @@ -842,6 +842,7 @@ box_loaded( int sts, message_t *msgs, int total_msgs, int recent_msgs, void *aux if (svars->state[t] & ST_FIND_OLD) { debug( "matching previously copied messages on %s\n", str_fn[t] ); + for (; msgs && msgs->uid < svars->finduid[t]; msgs = msgs->next) {} match_tuids( svars, t, msgs ); }