]> git.notmuchmail.org Git - notmuch/commitdiff
perf-test: cache unpacked corpus
authorDavid Bremner <bremner@debian.org>
Mon, 3 Dec 2012 12:13:31 +0000 (08:13 -0400)
committerDavid Bremner <bremner@debian.org>
Sat, 15 Dec 2012 12:17:57 +0000 (08:17 -0400)
Unpacking is not really the expensive step (compared to the initial
notmuch new), but this is a pre-requisite to caching the database.

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

index 53f26973620f28ef818fad9be04236b6a319107e..796ed01e44b8395f1b17a2ce64a15e8267b45c9d 100644 (file)
@@ -1 +1,2 @@
 tmp.*/
 tmp.*/
+corpus/
index 5d2acbd7a02cb8d74602f5307e01688920c85423..63e4c3d19087d6177c82bf3ea8e460c60231d573 100644 (file)
@@ -29,4 +29,4 @@ $(TXZFILE):
 download-corpus:
        wget -O ${TXZFILE} ${DEFAULT_URL}
 
 download-corpus:
        wget -O ${TXZFILE} ${DEFAULT_URL}
 
-CLEAN := $(CLEAN) $(dir)/tmp.*
+CLEAN := $(CLEAN) $(dir)/tmp.* $(dir)/corpus
index bdf92449f2b2a198b81058d7278f920c3661a70f..53ef96dae8b28d1afd3a609000719d01695b1daa 100644 (file)
@@ -39,33 +39,50 @@ add_email_corpus ()
 {
     rm -rf ${MAIL_DIR}
 
 {
     rm -rf ${MAIL_DIR}
 
-    case "$1" in
-       --small)
-           arg="mail/enron/bailey-s"
+    case "$corpus_size" in
+       small)
+           mail_subdir="mail/enron/bailey-s"
+           check_for="${TEST_DIRECTORY}/corpus/$mail_subdir"
            ;;
            ;;
-       --medium)
-           arg="mail/notmuch-archive"
+       medium)
+           mail_subdir="mail/notmuch-archive"
+           check_for="${TEST_DIRECTORY}/corpus/$mail_subdir"
            ;;
        *)
            ;;
        *)
-           arg=mail
+           mail_subdir=mail
+           check_for="${TEST_DIRECTORY}/corpus/$mail_subdir/enron/wolfe-j"
     esac
 
     esac
 
-    if command -v pixz > /dev/null; then
-       XZ=pixz
-    else
-       XZ=xz
+    MAIL_CORPUS="${TEST_DIRECTORY}/corpus/$mail_subdir"
+    args=()
+    if [ ! -d "$check_for" ] ; then
+       args+=("notmuch-email-corpus/$mail_subdir")
     fi
 
     fi
 
-    printf "Unpacking corpus\n"
-    tar --checkpoint=.5000 --extract --strip-components=1 \
-       --directory ${TMP_DIRECTORY} \
-       --use-compress-program ${XZ} \
-       --file ../download/notmuch-email-corpus-${PERFTEST_VERSION}.tar.xz \
-       notmuch-email-corpus/"$arg"
+    if [[ ${#args[@]} > 0 ]]; then
+       if command -v pixz > /dev/null; then
+           XZ=pixz
+       else
+           XZ=xz
+       fi
+
+       printf "Unpacking corpus\n"
+       mkdir -p "${TEST_DIRECTORY}/corpus"
+
+       tar --checkpoint=.5000 --extract --strip-components=1 \
+           --directory ${TEST_DIRECTORY}/corpus \
+           --use-compress-program ${XZ} \
+           --file ../download/notmuch-email-corpus-${PERFTEST_VERSION}.tar.xz \
+           "${args[@]}"
+
+       printf "\n"
 
 
-    printf "\n"
+    fi
+
+    cp -lr $MAIL_CORPUS $MAIL_DIR
 }
 
 }
 
+
 print_header () {
     printf "[v%4s %6s]          Wall(s)\tUsr(s)\tSys(s)\tRes(K)\tIn/Out(512B)\n" \
           ${PERFTEST_VERSION} ${corpus_size}
 print_header () {
     printf "[v%4s %6s]          Wall(s)\tUsr(s)\tSys(s)\tRes(K)\tIn/Out(512B)\n" \
           ${PERFTEST_VERSION} ${corpus_size}