--- /dev/null
+Return-Path: <bremner@tethera.net>\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 D8B96431FB6\r
+ for <notmuch@notmuchmail.org>; Mon, 3 Dec 2012 17:17:42 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\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 ZjFj4DV8ft+e for <notmuch@notmuchmail.org>;\r
+ Mon, 3 Dec 2012 17:17:39 -0800 (PST)\r
+Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238])\r
+ (using TLSv1 with cipher AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 42328431FC0\r
+ for <notmuch@notmuchmail.org>; Mon, 3 Dec 2012 17:17:39 -0800 (PST)\r
+Received: from fctnnbsc30w-142167090129.dhcp-dynamic.fibreop.nb.bellaliant.net\r
+ ([142.167.90.129] helo=zancas.localnet)\r
+ by tesseract.cs.unb.ca with esmtpsa\r
+ (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72)\r
+ (envelope-from <bremner@tethera.net>)\r
+ id 1Tfh8k-00081X-Gu; Mon, 03 Dec 2012 21:17:38 -0400\r
+Received: from bremner by zancas.localnet with local (Exim 4.80)\r
+ (envelope-from <bremner@tethera.net>)\r
+ id 1Tfh8f-0002kh-2C; Mon, 03 Dec 2012 21:17:33 -0400\r
+From: david@tethera.net\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 3/3] perf-test: add caching of xapian database.\r
+Date: Mon, 3 Dec 2012 21:17:04 -0400\r
+Message-Id: <1354583824-10520-3-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <1354583824-10520-1-git-send-email-david@tethera.net>\r
+References: <1354583824-10520-1-git-send-email-david@tethera.net>\r
+X-Spam_bar: -\r
+Cc: David Bremner <bremner@debian.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: Tue, 04 Dec 2012 01:17:43 -0000\r
+\r
+From: David Bremner <bremner@debian.org>\r
+\r
+The caching and uncaching seem to be necessarily manual, as timing the\r
+initial notmuch new is one of our goals with this suite.\r
+---\r
+ performance-test/.gitignore | 1 +\r
+ performance-test/Makefile.local | 2 +-\r
+ performance-test/basic | 5 +++++\r
+ performance-test/perf-test-lib.sh | 18 ++++++++++++++++++\r
+ 4 files changed, 25 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/performance-test/.gitignore b/performance-test/.gitignore\r
+index 7e20f7c..779a115 100644\r
+--- a/performance-test/.gitignore\r
++++ b/performance-test/.gitignore\r
+@@ -1,2 +1,3 @@\r
+ tmp.*/\r
+ corpus.mail.*/\r
++notmuch.cache.*/\r
+diff --git a/performance-test/Makefile.local b/performance-test/Makefile.local\r
+index eb713d0..b136a88 100644\r
+--- a/performance-test/Makefile.local\r
++++ b/performance-test/Makefile.local\r
+@@ -29,4 +29,4 @@ $(TXZFILE):\r
+ download-corpus:\r
+ wget -O ${TXZFILE} ${DEFAULT_URL}\r
+ \r
+-CLEAN := $(CLEAN) $(dir)/tmp.* $(dir)/corpus.mail.*\r
++CLEAN := $(CLEAN) $(dir)/tmp.* $(dir)/corpus.mail.* $(dir)/notmuch.cache.*\r
+diff --git a/performance-test/basic b/performance-test/basic\r
+index 9d015ee..41a7ff1 100755\r
+--- a/performance-test/basic\r
++++ b/performance-test/basic\r
+@@ -2,11 +2,16 @@\r
+ \r
+ . ./perf-test-lib.sh\r
+ \r
++uncache_database\r
++\r
+ add_email_corpus\r
+ \r
+ print_header\r
+ \r
+ time_run 'initial notmuch new' 'notmuch new'\r
++\r
++cache_database\r
++\r
+ time_run 'second notmuch new' 'notmuch new'\r
+ time_run 'dump *' 'notmuch dump > tags.out'\r
+ time_run 'restore *' 'notmuch restore < tags.out'\r
+diff --git a/performance-test/perf-test-lib.sh b/performance-test/perf-test-lib.sh\r
+index 9fbf874..c9b131a 100644\r
+--- a/performance-test/perf-test-lib.sh\r
++++ b/performance-test/perf-test-lib.sh\r
+@@ -36,6 +36,8 @@ then\r
+ fi\r
+ \r
+ CORPUS_DIR=${TEST_DIRECTORY}/corpus.mail.$corpus_size\r
++DB_CACHE_DIR=${TEST_DIRECTORY}/notmuch.cache.$corpus_size\r
++\r
+ add_email_corpus ()\r
+ {\r
+ rm -rf ${MAIL_DIR}\r
+@@ -69,9 +71,25 @@ add_email_corpus ()\r
+ printf "\n"\r
+ \r
+ fi\r
++\r
+ cp -lr $CORPUS_DIR $MAIL_DIR\r
++\r
++ if [ -d $DB_CACHE_DIR ]; then\r
++ cp -r $DB_CACHE_DIR ${MAIL_DIR}/.notmuch\r
++ fi\r
+ }\r
+ \r
++cache_database () {\r
++ if [ -d $MAIL_DIR/.notmuch ]; then\r
++ cp -r $MAIL_DIR/.notmuch $DB_CACHE_DIR\r
++ else\r
++ echo "Warning: No database found to cache"\r
++ fi\r
++}\r
++\r
++uncache_database () {\r
++ rm -rf $DB_CACHE_DIR\r
++}\r
+ \r
+ print_header () {\r
+ printf "[v%4s] Wall(s)\tUsr(s)\tSys(s)\tRes(K)\tIn(512B)\tOut(512B)\n" \\r
+-- \r
+1.7.10.4\r
+\r