[PATCH 2/3] new: Add all initial tags at once

Michal Sojka sojkam1 at fel.cvut.cz
Fri Jan 21 01:59:36 PST 2011


If there are several tags applied to the new messages, it is beneficial
to store them to the database at one, because it saves some time,
especially when the notmuch new is run for the first time.

This patch decreased the time for initial import from 1h 35m to 1h 14m.
---
 notmuch-new.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/notmuch-new.c b/notmuch-new.c
index a2af045..d71e497 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -418,6 +418,7 @@ add_files_recursive (notmuch_database_t *notmuch,
 	/* success */
 	case NOTMUCH_STATUS_SUCCESS:
 	    state->added_messages++;
+	    notmuch_message_freeze (message);
 	    for (tag=state->new_tags; *tag != NULL; tag++)
 	        notmuch_message_add_tag (message, *tag);
 	    if (state->synchronize_flags == TRUE) {
@@ -433,6 +434,7 @@ add_files_recursive (notmuch_database_t *notmuch,
 		    notmuch_message_maildir_flags_to_tags (message);
 		}
 	    }
+	    notmuch_message_thaw (message);
 	    break;
 	/* Non-fatal issues (go on to next file) */
 	case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID:
-- 
1.7.2.3



More information about the notmuch mailing list