aboutsummaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorPeter Seebach <peter.seebach@windriver.com>2013-02-14 18:40:43 -0600
committerPeter Seebach <peter.seebach@windriver.com>2013-02-16 19:26:02 -0600
commit43349b7add81fbeecf1aaa43b3e3531bc4ff20be (patch)
tree7156b46c5f7433f64911459650ded0e42ff4bc81 /configure
parent011b401fb6be38d739215e455588af4dcd707e17 (diff)
downloadpseudo-43349b7add81fbeecf1aaa43b3e3531bc4ff20be.tar.gz
pseudo-43349b7add81fbeecf1aaa43b3e3531bc4ff20be.tar.bz2
pseudo-43349b7add81fbeecf1aaa43b3e3531bc4ff20be.zip
Use in-memory database for files
It turns out that file databases don't get very large, and that sqlite3 can be quite fast with an in-memory database. It also turns out that dumping the database to disk on exit (or during idle times) is pretty cheap compared to constant updates. So: We add "--enable-memory-db", which defaults to on if you have sqlite 3.7 or later, and off for 3.6 (because 3.6 has horrible performance with in-memory db on some hosts we tried).
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure32
1 files changed, 32 insertions, 0 deletions
diff --git a/configure b/configure
index 9cb7804..44bee74 100755
--- a/configure
+++ b/configure
@@ -25,6 +25,7 @@ opt_arch=x86
opt_bits=
opt_sqlite=/usr
opt_rpath=
+opt_memory=
compile_x86_32=-m32
compile_x86_64=-m64
@@ -35,6 +36,7 @@ usage()
echo >&2 " configure --prefix=..."
echo >&2 " [--libdir=...]"
echo >&2 " [--suffix=...]"
+ echo >&2 " [--enable-memory-db]"
echo >&2 " [--with-sqlite=...]"
echo >&2 " [--with-sqlite-lib=...]"
echo >&2 " [--enable-static-sqlite]"
@@ -69,6 +71,12 @@ do
sqlite_ldarg='$(SQLITE)/$(SQLITE_LIB)/libsqlite3.a'
use_maybe_rpath=false
;;
+ --enable-memory-db=no)
+ opt_memory=false
+ ;;
+ --enable-memory-db=yes | --enable-memory-db)
+ opt_memory=true
+ ;;
--with-sqlite=*)
opt_sqlite=${arg#--with-sqlite=}
# assign new value if unset
@@ -170,6 +178,29 @@ if [ "${SQLITE3_VERSION}" -lt "03006000" ]; then
exit 1
fi
+if [ -z "$opt_memory" ]; then
+ if [ "${SQLITE3_VERSION}" -lt "03007000" ]; then
+ echo "Disabling in-memory database by default (sqlite too old)."
+ opt_memory=false
+ else
+ echo "Enabling in-memory database by default."
+ opt_memory=true
+ fi
+fi
+
+if $opt_memory; then
+ if [ "${SQLITE3_VERSION}" -lt "03007000" ]; then
+ cat >&2 <<EOF
+WARNING: sqlite prior to 3.7 has been known to perform exceedingly poorly
+with the in-memory database option. You asked for it, you get it, but if
+you get horrible performance, try turning it off.
+EOF
+ fi
+ SQLITE_MEMORY="-DUSE_MEMORY_DB"
+else
+ SQLITE_MEMORY=""
+fi
+
sed -e '
s,@PREFIX@,'"$opt_prefix"',g
s,@LIBDIR@,'"$opt_libdir"',g
@@ -179,6 +210,7 @@ sed -e '
s,@ARCH_FLAGS@,'"$arch_flags"',g
s,@SQLITE_LDARG@,'"$sqlite_ldarg"',g
s,@SQLITE_LIB@,'"$opt_sqlite_lib"',g
+ s,@SQLITE_MEMORY@,'"$SQLITE_MEMORY"',g
s!@RPATH@!'"$opt_rpath"'!g
s,@MARK64@,'"$opt_mark64"',g
s,@ARCH@,'"$opt_arch"',g