--- /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 B2412431FD6\r
+ for <notmuch@notmuchmail.org>; Mon, 3 Dec 2012 17:17:40 -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 j70a4mTR2m02 for <notmuch@notmuchmail.org>;\r
+ Mon, 3 Dec 2012 17:17:36 -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 D10A2431FBC\r
+ for <notmuch@notmuchmail.org>; Mon, 3 Dec 2012 17:17:35 -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 1Tfh8g-00081S-OF; Mon, 03 Dec 2012 21:17:34 -0400\r
+Received: from bremner by zancas.localnet with local (Exim 4.80)\r
+ (envelope-from <bremner@tethera.net>)\r
+ id 1Tfh8b-0002ka-9g; Mon, 03 Dec 2012 21:17:29 -0400\r
+From: david@tethera.net\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/3] perf-test: cache unpacked corpus\r
+Date: Mon, 3 Dec 2012 21:17:03 -0400\r
+Message-Id: <1354583824-10520-2-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:41 -0000\r
+\r
+From: David Bremner <bremner@debian.org>\r
+\r
+Unpacking is not really the expensive step (compared to the initial\r
+notmuch new), but this is a pre-requisite to caching the database.\r
+---\r
+ performance-test/.gitignore | 1 +\r
+ performance-test/Makefile.local | 2 +-\r
+ performance-test/perf-test-lib.sh | 51 +++++++++++++++++++++----------------\r
+ 3 files changed, 31 insertions(+), 23 deletions(-)\r
+\r
+diff --git a/performance-test/.gitignore b/performance-test/.gitignore\r
+index 53f2697..7e20f7c 100644\r
+--- a/performance-test/.gitignore\r
++++ b/performance-test/.gitignore\r
+@@ -1 +1,2 @@\r
+ tmp.*/\r
++corpus.mail.*/\r
+diff --git a/performance-test/Makefile.local b/performance-test/Makefile.local\r
+index 5d2acbd..eb713d0 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.*\r
++CLEAN := $(CLEAN) $(dir)/tmp.* $(dir)/corpus.mail.*\r
+diff --git a/performance-test/perf-test-lib.sh b/performance-test/perf-test-lib.sh\r
+index bba793d..9fbf874 100644\r
+--- a/performance-test/perf-test-lib.sh\r
++++ b/performance-test/perf-test-lib.sh\r
+@@ -35,37 +35,44 @@ then\r
+ exit 1\r
+ fi\r
+ \r
++CORPUS_DIR=${TEST_DIRECTORY}/corpus.mail.$corpus_size\r
+ add_email_corpus ()\r
+ {\r
+ rm -rf ${MAIL_DIR}\r
++ if [ ! -d $CORPUS_DIR ]; then\r
++ case "$corpus_size" in\r
++ small)\r
++ arg="mail/enron/bailey-s"\r
++ ;;\r
++ medium)\r
++ arg="mail/notmuch-archive"\r
++ ;;\r
++ *)\r
++ arg=mail\r
++ esac\r
+ \r
+- case "$1" in\r
+- --small)\r
+- arg="mail/enron/bailey-s"\r
+- ;;\r
+- --medium)\r
+- arg="mail/notmuch-archive"\r
+- ;;\r
+- *)\r
+- arg=mail\r
+- esac\r
++ if command -v pixz > /dev/null; then\r
++ XZ=pixz\r
++ else\r
++ XZ=xz\r
++ fi\r
+ \r
+- if command -v pixz > /dev/null; then\r
+- XZ=pixz\r
+- else\r
+- XZ=xz\r
+- fi\r
++ printf "Unpacking corpus\n"\r
++ mkdir $CORPUS_DIR\r
++\r
++ tar --checkpoint=.5000 --extract --strip-components=2 \\r
++ --directory $CORPUS_DIR \\r
++ --use-compress-program ${XZ} \\r
++ --file ../download/notmuch-email-corpus-${PERFTEST_VERSION}.tar.xz \\r
++ notmuch-email-corpus/"$arg"\r
+ \r
+- printf "Unpacking corpus\n"\r
+- tar --checkpoint=.5000 --extract --strip-components=1 \\r
+- --directory ${TMP_DIRECTORY} \\r
+- --use-compress-program ${XZ} \\r
+- --file ../download/notmuch-email-corpus-${PERFTEST_VERSION}.tar.xz \\r
+- notmuch-email-corpus/"$arg"\r
++ printf "\n"\r
+ \r
+- printf "\n"\r
++ fi\r
++ cp -lr $CORPUS_DIR $MAIL_DIR\r
+ }\r
+ \r
++\r
+ print_header () {\r
+ printf "[v%4s] Wall(s)\tUsr(s)\tSys(s)\tRes(K)\tIn(512B)\tOut(512B)\n" \\r
+ ${PERFTEST_VERSION}\r
+-- \r
+1.7.10.4\r
+\r