perf-test: cache unpacked corpus

Unpacking is not really the expensive step (compared to the initial
notmuch new), but this is a pre-requisite to caching the database.
This commit is contained in:
David Bremner 2012-12-03 08:13:31 -04:00
parent 925ebd1fde
commit 74a883562b
3 changed files with 36 additions and 18 deletions

View file

@ -1 +1,2 @@
tmp.*/ tmp.*/
corpus/

View file

@ -29,4 +29,4 @@ $(TXZFILE):
download-corpus: download-corpus:
wget -O ${TXZFILE} ${DEFAULT_URL} wget -O ${TXZFILE} ${DEFAULT_URL}
CLEAN := $(CLEAN) $(dir)/tmp.* CLEAN := $(CLEAN) $(dir)/tmp.* $(dir)/corpus

View file

@ -39,33 +39,50 @@ add_email_corpus ()
{ {
rm -rf ${MAIL_DIR} rm -rf ${MAIL_DIR}
case "$1" in case "$corpus_size" in
--small) small)
arg="mail/enron/bailey-s" mail_subdir="mail/enron/bailey-s"
check_for="${TEST_DIRECTORY}/corpus/$mail_subdir"
;; ;;
--medium) medium)
arg="mail/notmuch-archive" 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 MAIL_CORPUS="${TEST_DIRECTORY}/corpus/$mail_subdir"
XZ=pixz args=()
else if [ ! -d "$check_for" ] ; then
XZ=xz args+=("notmuch-email-corpus/$mail_subdir")
fi fi
printf "Unpacking corpus\n" if [[ ${#args[@]} > 0 ]]; then
tar --checkpoint=.5000 --extract --strip-components=1 \ if command -v pixz > /dev/null; then
--directory ${TMP_DIRECTORY} \ XZ=pixz
--use-compress-program ${XZ} \ else
--file ../download/notmuch-email-corpus-${PERFTEST_VERSION}.tar.xz \ XZ=xz
notmuch-email-corpus/"$arg" fi
printf "\n" 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"
fi
cp -lr $MAIL_CORPUS $MAIL_DIR
} }
print_header () { print_header () {
printf "[v%4s %6s] Wall(s)\tUsr(s)\tSys(s)\tRes(K)\tIn/Out(512B)\n" \ printf "[v%4s %6s] Wall(s)\tUsr(s)\tSys(s)\tRes(K)\tIn/Out(512B)\n" \
${PERFTEST_VERSION} ${corpus_size} ${PERFTEST_VERSION} ${corpus_size}