Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 01F9442D28D for ; Fri, 21 Jan 2011 01:59:57 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FDLW2EMjBz-M for ; Fri, 21 Jan 2011 01:59:56 -0800 (PST) Received: from mail.loccal.net (gw.loccal.net [94.142.235.206]) by olra.theworths.org (Postfix) with ESMTP id 13D70431FB6 for ; Fri, 21 Jan 2011 01:59:51 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by mail.loccal.net (Postfix) with ESMTP id 04182563D; Fri, 21 Jan 2011 11:12:27 +0100 (CET) X-Virus-Scanned: amavisd-new at loccal.net Received: from mail.loccal.net ([127.0.0.1]) by localhost (mail.loccal.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id tKDgWzwWEWIh; Fri, 21 Jan 2011 11:12:23 +0100 (CET) Received: from steelpick.2x.cz (unknown [10.21.129.4]) by mail.loccal.net (Postfix) with ESMTPS id E473A1886D; Fri, 21 Jan 2011 11:12:18 +0100 (CET) Received: from wsh by steelpick.2x.cz with local (Exim 4.72) (envelope-from ) id 1PgDmP-0003jm-Iw; Fri, 21 Jan 2011 10:59:41 +0100 From: Michal Sojka To: notmuch@notmuchmail.org Subject: [PATCH 2/3] new: Add all initial tags at once Date: Fri, 21 Jan 2011 10:59:36 +0100 Message-Id: <1295603977-14326-4-git-send-email-sojkam1@fel.cvut.cz> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1295603977-14326-1-git-send-email-sojkam1@fel.cvut.cz> References: <1295603977-14326-1-git-send-email-sojkam1@fel.cvut.cz> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Jan 2011 09:59:57 -0000 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