]> git.notmuchmail.org Git - notmuch/commitdiff
perf-test: add caching of xapian database
authorDavid Bremner <bremner@debian.org>
Mon, 3 Dec 2012 12:48:53 +0000 (08:48 -0400)
committerDavid Bremner <bremner@debian.org>
Sat, 15 Dec 2012 12:17:58 +0000 (08:17 -0400)
The caching and uncaching seem to be necessarily manual, as timing the
initial notmuch new is one of our goals with this suite.

performance-test/.gitignore
performance-test/Makefile.local
performance-test/basic
performance-test/perf-test-lib.sh

index 796ed01e44b8395f1b17a2ce64a15e8267b45c9d..6421a9ad88e14db36ca000b52140813f4c7568b2 100644 (file)
@@ -1,2 +1,3 @@
 tmp.*/
 corpus/
+notmuch.cache.*/
index 63e4c3d19087d6177c82bf3ea8e460c60231d573..3834e4d70e5f28b019f50f9dbc16f30e3f77599f 100644 (file)
@@ -29,4 +29,4 @@ $(TXZFILE):
 download-corpus:
        wget -O ${TXZFILE} ${DEFAULT_URL}
 
-CLEAN := $(CLEAN) $(dir)/tmp.* $(dir)/corpus
+CLEAN := $(CLEAN) $(dir)/tmp.* $(dir)/corpus $(dir)/notmuch.cache.*
index 9d015eec15633a134f3e52e9c9c729fffb22bdc2..41a7ff1a75ac6a9ec2bde435f69ab0c73d259df1 100755 (executable)
@@ -2,11 +2,16 @@
 
 . ./perf-test-lib.sh
 
+uncache_database
+
 add_email_corpus
 
 print_header
 
 time_run 'initial notmuch new' 'notmuch new'
+
+cache_database
+
 time_run 'second notmuch new' 'notmuch new'
 time_run 'dump *' 'notmuch dump > tags.out'
 time_run 'restore *' 'notmuch restore < tags.out'
index 53ef96dae8b28d1afd3a609000719d01695b1daa..564b688476db3d9db68beced9f77b1aaeaae9aac 100644 (file)
@@ -35,6 +35,8 @@ then
        exit 1
 fi
 
+DB_CACHE_DIR=${TEST_DIRECTORY}/notmuch.cache.$corpus_size
+
 add_email_corpus ()
 {
     rm -rf ${MAIL_DIR}
@@ -80,8 +82,34 @@ add_email_corpus ()
     fi
 
     cp -lr $MAIL_CORPUS $MAIL_DIR
+
+}
+
+time_start () {
+
+    add_email_corpus
+
+    print_header
+
+    if [ -d $DB_CACHE_DIR ]; then
+       cp -r $DB_CACHE_DIR ${MAIL_DIR}/.notmuch
+    else
+       time_run 'Initial notmuch new' "notmuch new"
+       cache_database
+    fi
 }
 
+cache_database () {
+    if [ -d $MAIL_DIR/.notmuch ]; then
+       cp -r $MAIL_DIR/.notmuch $DB_CACHE_DIR
+    else
+       echo "Warning: No database found to cache"
+    fi
+}
+
+uncache_database () {
+    rm -rf $DB_CACHE_DIR
+}
 
 print_header () {
     printf "[v%4s %6s]          Wall(s)\tUsr(s)\tSys(s)\tRes(K)\tIn/Out(512B)\n" \