[Patch v3 06/11] perf-test: add caching of xapian database
authordavid <david@tethera.net>
Sat, 15 Dec 2012 12:45:09 +0000 (08:45 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:52:16 +0000 (09:52 -0800)
04/43e4d60d648e013906dbd1900b85b92ae15b47 [new file with mode: 0644]

diff --git a/04/43e4d60d648e013906dbd1900b85b92ae15b47 b/04/43e4d60d648e013906dbd1900b85b92ae15b47
new file mode 100644 (file)
index 0000000..c0417e5
--- /dev/null
@@ -0,0 +1,155 @@
+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 88D1A42116D\r
+       for <notmuch@notmuchmail.org>; Sat, 15 Dec 2012 04:45:31 -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 4FuTQulUujFZ for <notmuch@notmuchmail.org>;\r
+       Sat, 15 Dec 2012 04:45:30 -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 AD994431FBF\r
+       for <notmuch@notmuchmail.org>; Sat, 15 Dec 2012 04:45:28 -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 1Tjr7P-0006C0-T4; Sat, 15 Dec 2012 08:45:28 -0400\r
+Received: from bremner by zancas.localnet with local (Exim 4.80)\r
+       (envelope-from <bremner@tethera.net>)\r
+       id 1Tjr7K-00008U-C6; Sat, 15 Dec 2012 08:45:22 -0400\r
+From: david@tethera.net\r
+To: notmuch@notmuchmail.org\r
+Subject: [Patch v3 06/11] perf-test: add caching of xapian database\r
+Date: Sat, 15 Dec 2012 08:45:09 -0400\r
+Message-Id: <1355575514-32735-7-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <1355575514-32735-1-git-send-email-david@tethera.net>\r
+References: <1355575514-32735-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: Sat, 15 Dec 2012 12:45:31 -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 |   28 ++++++++++++++++++++++++++++\r
+ 4 files changed, 35 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/performance-test/.gitignore b/performance-test/.gitignore\r
+index 796ed01..6421a9a 100644\r
+--- a/performance-test/.gitignore\r
++++ b/performance-test/.gitignore\r
+@@ -1,2 +1,3 @@\r
+ tmp.*/\r
+ corpus/\r
++notmuch.cache.*/\r
+diff --git a/performance-test/Makefile.local b/performance-test/Makefile.local\r
+index 63e4c3d..3834e4d 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\r
++CLEAN := $(CLEAN) $(dir)/tmp.* $(dir)/corpus $(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 53ef96d..564b688 100644\r
+--- a/performance-test/perf-test-lib.sh\r
++++ b/performance-test/perf-test-lib.sh\r
+@@ -35,6 +35,8 @@ then\r
+       exit 1\r
+ fi\r
\r
++DB_CACHE_DIR=${TEST_DIRECTORY}/notmuch.cache.$corpus_size\r
++\r
+ add_email_corpus ()\r
+ {\r
+     rm -rf ${MAIL_DIR}\r
+@@ -80,8 +82,34 @@ add_email_corpus ()\r
+     fi\r
\r
+     cp -lr $MAIL_CORPUS $MAIL_DIR\r
++\r
++}\r
++\r
++time_start () {\r
++\r
++    add_email_corpus\r
++\r
++    print_header\r
++\r
++    if [ -d $DB_CACHE_DIR ]; then\r
++      cp -r $DB_CACHE_DIR ${MAIL_DIR}/.notmuch\r
++    else\r
++      time_run 'Initial notmuch new' "notmuch new"\r
++      cache_database\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 %6s]          Wall(s)\tUsr(s)\tSys(s)\tRes(K)\tIn/Out(512B)\n" \\r
+-- \r
+1.7.10.4\r
+\r