--- /dev/null
+Return-Path: <Vladimir.Marek@Oracle.COM>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 73636431FD2\r
+ for <notmuch@notmuchmail.org>; Sat, 31 Aug 2013 23:59:42 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.299\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.299 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_MED=-2.3, UNPARSEABLE_RELAY=0.001]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id i60PTRgDCTRV for <notmuch@notmuchmail.org>;\r
+ Sat, 31 Aug 2013 23:59:36 -0700 (PDT)\r
+Received: from userp1040.oracle.com (userp1040.oracle.com [156.151.31.81])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 6250B41A56A\r
+ for <notmuch@notmuchmail.org>; Thu, 29 Aug 2013 12:41:27 -0700 (PDT)\r
+Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238])\r
+ by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with\r
+ ESMTP id r7TJfMAV010250\r
+ (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);\r
+ Thu, 29 Aug 2013 19:41:23 GMT\r
+Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85])\r
+ by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id\r
+ r7TJfLOs006806\r
+ (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);\r
+ Thu, 29 Aug 2013 19:41:22 GMT\r
+Received: from abhmt101.oracle.com (abhmt101.oracle.com [141.146.116.53])\r
+ by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id\r
+ r7TJfLjh007382; Thu, 29 Aug 2013 19:41:21 GMT\r
+Received: from virt.cz.oracle.com (/10.163.102.127)\r
+ by default (Oracle Beehive Gateway v4.0)\r
+ with ESMTP ; Thu, 29 Aug 2013 12:41:20 -0700\r
+Date: Thu, 29 Aug 2013 21:41:14 +0200\r
+From: Vladimir Marek <Vladimir.Marek@Oracle.COM>\r
+To: Austin Clements <amdragon@mit.edu>\r
+Subject: Re: Re: Possible addtions to notmuch new ?\r
+Message-ID: <20130829194114.GA133@virt.cz.oracle.com>\r
+References: <20130812093443.GB16684@virt.cz.oracle.com>\r
+ <20130812143426.GA13257@mit.edu>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Disposition: inline\r
+In-Reply-To: <20130812143426.GA13257@mit.edu>\r
+User-Agent: Mutt/ (2012-12-30)\r
+X-Source-IP: acsinet22.oracle.com [141.146.126.238]\r
+Cc: notmuch@notmuchmail.org\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 01 Sep 2013 06:59:42 -0000\r
+\r
+\r
+\r
+> > My mail setup is a directory containing several subdirectories each\r
+> > subdirectory corresponds to one real mail account I am using. Each mail\r
+> > account is synchronized differently - I am using offlineimap, fetchmeail\r
+> > or even synthetically created emails (I am writing very simple jabber<->\r
+> > mail gate).Every now and then I am running 'notmuch new' to discover new\r
+> > emails and make them available in my MUA.\r
+> > \r
+> > That works pretty well, but has some disadvantages too\r
+> > - notmuch new takes very long time (30s) during which the notmuch\r
+> > database seems to be locked for any other updates from my MUA\r
+> > - notmuch new takes long time because it always processes my archive\r
+> > dir containing many files. That's mostly un-necessary as typically\r
+> > there's no new mail delivered\r
+> \r
+> Could you try this patch? It's basically untested other than passing\r
+> the test suite, though in principle the worst harm it could do is make\r
+> notmuch new miss new messages or think renames are deletions. If it\r
+> helps significantly with your performance problems, I'll clean it up\r
+> and add a test.\r
+> \r
+> diff --git a/notmuch-new.c b/notmuch-new.c\r
+> index faa33f1..196c5cb 100644\r
+> --- a/notmuch-new.c\r
+> +++ b/notmuch-new.c\r
+> @@ -323,6 +323,9 @@ add_files (notmuch_database_t *notmuch,\r
+> }\r
+> db_mtime = directory ? notmuch_directory_get_mtime (directory) : 0;\r
+> \r
+> + if (directory && db_mtime == fs_mtime && st.st_nlink == 2)\r
+> + goto DONE;\r
+> +\r
+> /* If the database knows about this directory, then we sort based\r
+> * on strcmp to match the database sorting. Otherwise, we can do\r
+> * inode-based sorting for faster filesystem operation. */\r
+\r
+\r
+I'm sorry for my late reply. It cuts the average time of 'notmuch new'\r
+from 25s to 0.2s . Which is a bit scary :) But understandable. I have\r
+the notmuch database on NFS mount which hopefully won't make any\r
+difference here.\r
+\r
+Thank you for the tip!\r
+-- \r
+ Vlad\r