diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-12-28 14:37:37 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-12-28 14:37:37 +0200 |
commit | d85540094f0df7258af1cae7c61cc6d45c2a4f53 (patch) | |
tree | f7315477b24e65729cdce00c617281f5c5d48583 /include/mailutils/sys/amd.h | |
parent | 42838314448528fd390d93a0b07a0d3d2d9d312f (diff) | |
download | mailutils-d85540094f0df7258af1cae7c61cc6d45c2a4f53.tar.gz mailutils-d85540094f0df7258af1cae7c61cc6d45c2a4f53.tar.bz2 |
mh,maildir: speed up scanning.
* include/mailutils/sys/amd.h (_amd_message_append, amd_sort): New protos.
* libmailutils/base/amd.c (amd_array_expand): Call memmove only if there is
actually something to move.
(_amd_message_append, amd_sort): New functions.
* libproto/maildir/mbox.c (maildir_scan_dir): Append new messages to the
end of the array, and sort it afterwards. This avoids unnecessary memory
moves, which improves performance considerably, especially on large
mailboxes.
* libproto/mh/mbox.c (mh_scan0): Likewise.
Diffstat (limited to 'include/mailutils/sys/amd.h')
-rw-r--r-- | include/mailutils/sys/amd.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/mailutils/sys/amd.h b/include/mailutils/sys/amd.h index 2bc8dc721..e96e3ca6a 100644 --- a/include/mailutils/sys/amd.h +++ b/include/mailutils/sys/amd.h @@ -110,6 +110,8 @@ int _amd_message_lookup_or_insert (struct _amd_data *amd, struct _amd_message *key, size_t *pindex); int _amd_message_insert (struct _amd_data *mhd, struct _amd_message *msg); +int _amd_message_append (struct _amd_data *amd, struct _amd_message *msg); +void amd_sort (struct _amd_data *amd); int amd_message_stream_open (struct _amd_message *mhm); void amd_message_stream_close (struct _amd_message *mhm); void amd_cleanup (void *arg); |