From: Art Cancro Date: Fri, 20 May 2005 16:14:44 +0000 (+0000) Subject: * Dramatically improved the time it takes to goto (or select) a room which X-Git-Tag: v7.86~4895 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=4867a2746f9b3ad3a503e8930ef2ffffcf003c3a;p=citadel.git * Dramatically improved the time it takes to goto (or select) a room which contains a very long and complex seen/unseen list. Our test folder, containing 359 new of 3162 messages, formerly took 22 seconds to select; now it takes 1 to 2 seconds. --- diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 4d13a37e4..13d0567d2 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,10 @@ $Log$ + Revision 647.15 2005/05/20 16:14:43 ajc + * Dramatically improved the time it takes to goto (or select) a room which + contains a very long and complex seen/unseen list. Our test folder, + containing 359 new of 3162 messages, formerly took 22 seconds to select; + now it takes 1 to 2 seconds. + Revision 647.14 2005/05/20 02:37:17 ajc * Performance-optimized the full text indexer. @@ -6739,3 +6745,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/room_ops.c b/citadel/room_ops.c index f38368606..cb73a80cd 100644 --- a/citadel/room_ops.c +++ b/citadel/room_ops.c @@ -766,6 +766,7 @@ void usergoto(char *where, int display_result, int transiently, { int a; int new_messages = 0; + int old_messages = 0; int total_messages = 0; int info = 0; int rmailflag; @@ -777,6 +778,10 @@ void usergoto(char *where, int display_result, int transiently, long *msglist = NULL; int num_msgs = 0; unsigned int original_v_flags; + int num_sets; + int s; + char setstr[128], lostr[64], histr[64]; + long lo, hi; /* If the supplied room name is NULL, the caller wants us to know that * it has already copied the room record into CC->room, so @@ -825,14 +830,38 @@ void usergoto(char *where, int display_result, int transiently, cdb_free(cdbfr); } - if (num_msgs > 0) for (a = 0; a < num_msgs; ++a) { - if (msglist[a] > 0L) { - ++total_messages; - if (is_msg_in_sequence_set(vbuf.v_seen, msglist[a]) == 0) { - ++new_messages; + lprintf(CTDL_DEBUG, " *** START COUNT *** \n"); + total_messages = 0; + for (a=0; a 0L) ++total_messages; + } + new_messages = num_msgs; + num_sets = num_tokens(vbuf.v_seen, ','); + for (s=0; s= 2) { + extract_token(histr, setstr, 1, ':', sizeof histr); + if (!strcmp(histr, "*")) { + snprintf(histr, sizeof histr, "%ld", LONG_MAX); + } + } + else { + strcpy(histr, lostr); + } + lo = atol(lostr); + hi = atol(histr); + + for (a=0; a 0L) { + if ((msglist[a] >= lo) && (msglist[a] <= hi)) { + ++old_messages; + msglist[a] = 0L; } } } + lprintf(CTDL_DEBUG, " *** END COUNT *** \n"); + new_messages = total_messages - old_messages; if (msglist != NULL) free(msglist); diff --git a/citadel/tools.c b/citadel/tools.c index abdf2bc8d..3a6117435 100644 --- a/citadel/tools.c +++ b/citadel/tools.c @@ -414,7 +414,7 @@ void fmt_date(char *buf, size_t n, time_t thetime, int seconds) { int is_msg_in_sequence_set(char *mset, long msgnum) { int num_sets; int s; - char setstr[SIZ], lostr[SIZ], histr[SIZ]; + char setstr[128], lostr[128], histr[128]; long lo, hi; num_sets = num_tokens(mset, ',');