$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.
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
+
{
int a;
int new_messages = 0;
+ int old_messages = 0;
int total_messages = 0;
int info = 0;
int rmailflag;
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
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<num_msgs; ++a) {
+ if (msglist[a] > 0L) ++total_messages;
+ }
+ new_messages = num_msgs;
+ num_sets = num_tokens(vbuf.v_seen, ',');
+ for (s=0; s<num_sets; ++s) {
+ extract_token(setstr, vbuf.v_seen, s, ',', sizeof setstr);
+
+ extract_token(lostr, setstr, 0, ':', sizeof lostr);
+ if (num_tokens(setstr, ':') >= 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<num_msgs; ++a) if (msglist[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);
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, ',');