mirror of
https://git.notmuchmail.org/git/notmuch
synced 2025-01-03 15:21:41 +01:00
Do not defer maildir flag synchronization for new messages
This is a simplified version of a patch originally by Michal Sojka <sojkam1@fel.cvut.cz> which is designed to have the same performance benefits. Michal said the following: When notmuch new is run for the first time, it is not necessary to defer maildir flags synchronization to later because we already know that no files will be removed. Performing the maildinr flag synchronization immediately after the message is added to the database has the advantage that the message is likely hot in the disk cache so the synchronization is faster. Additionally, we also save one database query for each message, which must be performed when the operation is deferred. Without this patch, the first notmuch new of 200k messages (3 GB) took 1h and 46m out of which 20m was maildir flags synchronization. With this patch, the whole operation took only 1h and 36m. Unlike Michal's patch, this version does the deferral for any new message, rather than doing it only on the first run of "notmuch new".
This commit is contained in:
parent
4aeb291c78
commit
de2acbd49c
1 changed files with 1 additions and 4 deletions
|
@ -420,11 +420,8 @@ add_files_recursive (notmuch_database_t *notmuch,
|
||||||
state->added_messages++;
|
state->added_messages++;
|
||||||
for (tag=state->new_tags; *tag != NULL; tag++)
|
for (tag=state->new_tags; *tag != NULL; tag++)
|
||||||
notmuch_message_add_tag (message, *tag);
|
notmuch_message_add_tag (message, *tag);
|
||||||
/* Defer sync of maildir flags until after old filenames
|
|
||||||
* are removed in the case of a rename. */
|
|
||||||
if (state->synchronize_flags == TRUE)
|
if (state->synchronize_flags == TRUE)
|
||||||
_filename_list_add (state->message_ids_to_sync,
|
notmuch_message_maildir_flags_to_tags (message);
|
||||||
notmuch_message_get_message_id (message));
|
|
||||||
break;
|
break;
|
||||||
/* Non-fatal issues (go on to next file) */
|
/* Non-fatal issues (go on to next file) */
|
||||||
case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID:
|
case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID:
|
||||||
|
|
Loading…
Reference in a new issue