Mercurial > dovecot > core-2.2
changeset 361:7a0be5e88815 HEAD
Small optimization for mail_index_lookup() when there's only one hole in
index file.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 06 Oct 2002 05:15:27 +0300 |
parents | d57e5037db2c |
children | aa449d013563 |
files | src/lib-index/mail-index.c |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-index.c Sun Oct 06 05:00:19 2002 +0300 +++ b/src/lib-index/mail-index.c Sun Oct 06 05:15:27 2002 +0300 @@ -473,6 +473,13 @@ hdr->first_hole_position > pos) { /* easy, it's just at the expected index */ format = "Invalid first_hole_position in header: %"PRIuUOFF_T; + } else if (hdr->first_hole_records == + MAIL_INDEX_RECORD_COUNT(index) - hdr->messages_count) { + /* only one hole in file, skip it and we're at + correct position */ + pos += (size_t)hdr->first_hole_records * + sizeof(MailIndexRecord); + format = "Invalid hole locations in header: %"PRIuUOFF_T; } else { /* find from binary tree */ pos = mail_tree_lookup_sequence(index->tree, seq); @@ -751,10 +758,7 @@ hdr->first_hole_records++; update_first_hole_records(index); } else { - /* second hole coming to index file, the index now needs to - be compressed to keep high performance */ - index->set_flags |= MAIL_INDEX_FLAG_COMPRESS; - + /* second hole coming to index file */ if (hdr->first_hole_position > pos) { /* new hole before the old hole */ hdr->first_hole_position = pos;