dovecot-1.1: mail_index_bsearch_uid(): Small optimization.

dovecot at dovecot.org dovecot at dovecot.org
Thu Mar 6 10:27:07 EET 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/1bbef480786a
changeset: 7362:1bbef480786a
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Mar 06 10:26:52 2008 +0200
description:
mail_index_bsearch_uid(): Small optimization.

diffstat:

1 file changed, 1 insertion(+), 5 deletions(-)
src/lib-index/mail-index-view.c |    6 +-----

diffs (20 lines):

diff -r 11eb0bd76299 -r 1bbef480786a src/lib-index/mail-index-view.c
--- a/src/lib-index/mail-index-view.c	Thu Mar 06 09:45:17 2008 +0200
+++ b/src/lib-index/mail-index-view.c	Thu Mar 06 10:26:52 2008 +0200
@@ -222,15 +222,11 @@ static uint32_t mail_index_bsearch_uid(s
 	i_assert(view->map->hdr.messages_count <=
 		 view->map->rec_map->records_count);
 
-	if (uid == 1) {
-		/* optimization: the message can be only the first one */
-		return 1;
-	}
 	rec_base = view->map->rec_map->records;
 	record_size = view->map->hdr.record_size;
 
 	idx = left_idx;
-	right_idx = view->map->hdr.messages_count;
+	right_idx = I_MIN(view->map->hdr.messages_count, uid);
 
 	while (left_idx < right_idx) {
 		idx = (left_idx + right_idx) / 2;


More information about the dovecot-cvs mailing list