Hello,

Here is a patch that avoids parsing of whole messages when doing a header search. I have tested it briefly, and it seems to give a 15-20% speed improvement on such searches; but it does need more testing.

Note that it simply fetches only the rfc-headers instead of the whole message, leaving the rest of &msg zeroed out (the zero-out code was already there). So the code that lops through mime-headers and through children simply gets NULLs and therefore does nothing. This is somewhat of a hack, but avoids cluttering up the code and keeps the changes to a minimum.

All my dbmail patches are still on http://www.ramendik.ru/dbmail/index.html ; and all are aimed at 2.0.1.

Yours, Mikhail Ramendik
--- dbmail-orig/dbsearch.c	2004-11-05 01:17:57.711244102 +0300
+++ dbmail-new/dbsearch.c	2004-11-05 01:17:48.227028435 +0300
@@ -162,7 +162,17 @@
 	for (i = 0; i < setlen; i++) {
 		memset(&msg, 0, sizeof(msg));
 
-		result = db_fetch_headers(mb->seq_list[i], &msg);
+		switch (sk->type) {
+                case IST_HDR:
+                case IST_HDRDATE_BEFORE:
+                case IST_HDRDATE_ON:
+                case IST_HDRDATE_SINCE:
+                    result=db_get_main_header(mb->seq_list[i],&msg.rfcheader);
+                    break;
+                
+                default:
+                     result = db_fetch_headers(mb->seq_list[i], &msg);
+                }
 		if (result != 0)
 			continue;	/* ignore parse errors */
 

Reply via email to