]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Remove long-obsolete performance testing scripts from the tools/ folder.
authordrh <>
Mon, 28 Apr 2025 13:32:46 +0000 (13:32 +0000)
committerdrh <>
Mon, 28 Apr 2025 13:32:46 +0000 (13:32 +0000)
The test/speedtest.tcl script is what should be used these days.  This
is just cruft clean-up.

FossilOrigin-Name: 956af8c294ae5b826a5b645922df07dad360290d19bf2b6a7f74d0a783a3e692

manifest
manifest.uuid
tool/kvtest-speed.sh [deleted file]
tool/mkspeedsql.tcl [deleted file]
tool/run-speed-test.sh [deleted file]
tool/speed-check.sh [deleted file]
tool/speedtest.tcl [deleted file]
tool/speedtest16.c [deleted file]
tool/speedtest2.tcl [deleted file]
tool/speedtest8.c [deleted file]
tool/speedtest8inst1.c [deleted file]

index f6282811e996863ee11a44cef55c41cef98bb6ba..990637bbe58e2fed6480bfebcf3b03e73929d339 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C tea:\spull\sin\supstream\steaish.\sConsolidate\sthe\sbuild\sdefinition\sfrom\sthe\supstream\sbuild\sand\sthis\sone\sto\sease\smaintenace.\sImprove\scompatibility\swith\shistorical\sTEA\susage\sof\s--with-tcl=...\s(it\sinsists\son\sa\s/lib\ssuffix\sfor\sthat\spath).
-D 2025-04-28T09:25:19.852
+C Remove\slong-obsolete\sperformance\stesting\sscripts\sfrom\sthe\stools/\sfolder.\nThe\stest/speedtest.tcl\sscript\sis\swhat\sshould\sbe\sused\sthese\sdays.\s\sThis\nis\sjust\scruft\sclean-up.
+D 2025-04-28T13:32:46.678
 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -2143,7 +2143,6 @@ F tool/genfkey.README e550911fa984c8255ebed2ef97824125d83806eb5232582700de949edf
 F tool/genfkey.test b6afd7b825d797a1e1274f519ab5695373552ecad5cd373530c63533638a5a4f
 F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce
 F tool/index_usage.c f62a0c701b2c7ff2f3e21d206f093c123f222dbf07136a10ffd1ca15a5c706c5
-F tool/kvtest-speed.sh 4761a9c4b3530907562314d7757995787f7aef8f
 F tool/lemon.c f51a488369046cd4f4212d755a214a57673ded400cbeb01e298cbf63539e1d8c
 F tool/lempar.c bdffd3b233a4e4e78056c9c01fadd2bb3fe902435abde3bce3d769fdf0d5cca2
 F tool/libvers.c caafc3b689638a1d88d44bc5f526c2278760d9b9
@@ -2163,7 +2162,6 @@ F tool/mkopts.tcl 680f785fdb09729fd9ac50632413da4eadbdf9071535e3f26d03795828ab07
 F tool/mkpragmatab.tcl 3801ce32f8c55fe63a3b279f231fb26c2c1a2ea9a09d2dd599239d87a609acec
 F tool/mkshellc.tcl 9ce74de0fa904a2c56a96f8d8b5261246bacb0eaa8d7e184f9e18ff94145ebbc
 F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b079b9
-F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
 F tool/mksqlite3c-noext.tcl 351c55256213154cabb051a3c870ef9f4487de905015141ae50dc7578a901b84
 F tool/mksqlite3c.tcl f11b63445c4840509248bd4aa151a81aea25d5415fef71943c8d436eba4f3b3c
 F tool/mksqlite3h.tcl 989948c6a26e188e673d7c2f2f093ea3acd816ad6ac65bab596280075c8f3a45
@@ -2179,7 +2177,6 @@ F tool/pagesig.c f98909b4168d9cac11a2de7f031adea0e2f3131faa7515a72807c03ec58eafe
 F tool/replace.tcl 511c61acfe563dfb58675efb4628bb158a13d48ff8322123ac447e9d25a82d9a
 F tool/restore_jrnl.tcl 1079ecba47cc82fa82115b81c1f68097ab1f956f357ee8da5fc4b2589af6bd98
 F tool/rollback-test.c 9fc98427d1e23e84429d7e6d07d9094fbdec65a5
-F tool/run-speed-test.sh df9686c0991ea7c617b2cb5467d89d34b561f198ab91cb87735e27030ede92e8
 F tool/showdb.c 3956d71e5193162609a60e8c9edfcf09274c00cfea2b1d221261427adb2b5cca
 F tool/showjournal.c 5bad7ae8784a43d2b270d953060423b8bd480818
 F tool/showlocks.c 9cc5e66d4ebbf2d194f39db2527ece92077e86ae627ddd233ee48e16e8142564
@@ -2188,12 +2185,6 @@ F tool/showstat4.c 0682ebea7abf4d3657f53c4a243f2e7eab48eab344ed36a94bb75dcd19a5c
 F tool/showwal.c 11eca547980a066b081f512636151233350ac679f29ecf4ebfce7f4530230b3d
 F tool/soak1.tcl a3892082ed1079671565c044e93b55c3c7f38829aedf53cc597c65d23ffdaddf
 F tool/spaceanal.tcl 1f83962090a6b60e1d7bf92495d643e622bef9fe82ea3f2d22350dcbce9a12d0
-F tool/speed-check.sh 2d9e337449f8eb9f5ab4c1ce7433024e334ea03a68d48aa9caee6229c7cf0774
-F tool/speedtest.tcl 06c76698485ccf597b9e7dbb1ac70706eb873355
-F tool/speedtest16.c ecb6542862151c3e6509bbc00509b234562ae81e
-F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
-F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
-F tool/speedtest8inst1.c 7ce07da76b5e745783e703a834417d725b7d45fd
 F tool/spellsift.tcl 52b4b04dc4333c7ab024f09d9d66ed6b6f7c6eb00b38497a09f338fa55d40618 x
 F tool/split-sqlite3c.tcl 07e18a1d8cc3f6b3a4a1f3528e63c9b29a5c8a7bca0b8d394b231da464ce1247
 F tool/sqldiff.c 134be7866be19f8beb32043d5aea5657f01aaeae2df8d33d758ff722c78666b9
@@ -2216,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 7a2f4f319c90b768c6acc96671a3173c0ef0493180f3c4d5443f1ca03d92f6b4
-R 9db6b397f54d671a4320cc5ce752e15a
-U stephan
-Z a79c230793c16373c3792db45c1c451d
+P 0ea5993dd8549056d73f3d5447e0a810495ece23a75be8add78fba6842125d85
+R e9a7a5bb7d30c86d12fb872b44065ee2
+U drh
+Z faa21c2c7bc49d38601dda410afe3656
 # Remove this line to create a well-formed Fossil manifest.
index 9d9b32d403fb88d7ef9bda4a913ea5592be804fe..a89eb6ee7d2906e66d235d631036e11fd33bf6f4 100644 (file)
@@ -1 +1 @@
-0ea5993dd8549056d73f3d5447e0a810495ece23a75be8add78fba6842125d85
+956af8c294ae5b826a5b645922df07dad360290d19bf2b6a7f74d0a783a3e692
diff --git a/tool/kvtest-speed.sh b/tool/kvtest-speed.sh
deleted file mode 100644 (file)
index 5f2c834..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash
-#
-# A script for running speed tests using kvtest.
-#
-# The test database must be set up first.  Recommended
-# command-line:
-#
-#    ./kvtest init kvtest.db --count 100K --size 12K --variance 5K
-
-if test "$1" = ""
-then
-  echo "Usage: $0 OUTPUTFILE [OPTIONS]"
-  exit
-fi
-NAME=$1
-shift
-OPTS="-DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_DIRECT_OVERFLOW_READ -DUSE_PREAD"
-KVARGS="--count 100K --stats"
-gcc -g -Os -I. $OPTS $* kvtest.c sqlite3.c -o kvtest
-
-# First run using SQL
-rm cachegrind.out.[1-9][0-9]*
-valgrind --tool=cachegrind ./kvtest run kvtest.db $KVARGS 2>&1 | tee summary-kvtest-$NAME.txt
-mv cachegrind.out.[1-9][0-9]* cachegrind.out.sql-$NAME
-cg_anno.tcl cachegrind.out.sql-$NAME >cout-kvtest-sql-$NAME.txt
-
-# Second run using the sqlite3_blob object
-valgrind --tool=cachegrind ./kvtest run kvtest.db $KVARGS --blob-api 2>&1 | tee -a summary-kvtest-$NAME.txt
-mv cachegrind.out.[1-9][0-9]* cachegrind.out.$NAME
-cg_anno.tcl cachegrind.out.$NAME >cout-kvtest-$NAME.txt
-
-# Diff the sqlite3_blob API analysis for non-trunk runs.
-if test "$NAME" != "trunk"; then
-  fossil test-diff --tk cout-kvtest-trunk.txt cout-kvtest-$NAME.txt &
-fi
diff --git a/tool/mkspeedsql.tcl b/tool/mkspeedsql.tcl
deleted file mode 100644 (file)
index 04bafc0..0000000
+++ /dev/null
@@ -1,237 +0,0 @@
-# 2008 October 9
-#
-# The author disclaims copyright to this source code.  In place of
-# a legal notice, here is a blessing:
-#
-#    May you do good and not evil.
-#    May you find forgiveness for yourself and forgive others.
-#    May you share freely, never taking more than you give.
-#
-#*************************************************************************
-# This file generates SQL text used for performance testing.
-#
-# $Id: mkspeedsql.tcl,v 1.1 2008/10/09 17:57:34 drh Exp $
-#
-
-# Set a uniform random seed
-expr srand(0)
-
-# The number_name procedure below converts its argment (an integer)
-# into a string which is the English-language name for that number.
-#
-# Example:
-#
-#     puts [number_name 123]   ->  "one hundred twenty three"
-#
-set ones {zero one two three four five six seven eight nine
-          ten eleven twelve thirteen fourteen fifteen sixteen seventeen
-          eighteen nineteen}
-set tens {{} ten twenty thirty forty fifty sixty seventy eighty ninety}
-proc number_name {n} {
-  if {$n>=1000} {
-    set txt "[number_name [expr {$n/1000}]] thousand"
-    set n [expr {$n%1000}]
-  } else {
-    set txt {}
-  }
-  if {$n>=100} {
-    append txt " [lindex $::ones [expr {$n/100}]] hundred"
-    set n [expr {$n%100}]
-  }
-  if {$n>=20} {
-    append txt " [lindex $::tens [expr {$n/10}]]"
-    set n [expr {$n%10}]
-  }
-  if {$n>0} {
-    append txt " [lindex $::ones $n]"
-  }
-  set txt [string trim $txt]
-  if {$txt==""} {set txt zero}
-  return $txt
-}
-
-# Create a database schema.
-#
-puts {
-  PRAGMA page_size=1024;
-  PRAGMA cache_size=8192;
-  PRAGMA locking_mode=EXCLUSIVE;
-  CREATE TABLE t1(a INTEGER, b INTEGER, c TEXT);
-  CREATE TABLE t2(a INTEGER, b INTEGER, c TEXT);
-  CREATE INDEX i2a ON t2(a);
-  CREATE INDEX i2b ON t2(b);
-  SELECT name FROM sqlite_master ORDER BY 1;
-}
-
-
-# 50000 INSERTs on an unindexed table
-#
-set t1c_list {}
-puts {BEGIN;}
-for {set i 1} {$i<=50000} {incr i} {
-  set r [expr {int(rand()*500000)}]
-  set x [number_name $r]
-  lappend t1c_list $x
-  puts "INSERT INTO t1 VALUES($i,$r,'$x');"
-}
-puts {COMMIT;}
-
-# 50000 INSERTs on an indexed table
-#
-puts {BEGIN;}
-for {set i 1} {$i<=50000} {incr i} {
-  set r [expr {int(rand()*500000)}]
-  puts "INSERT INTO t2 VALUES($i,$r,'[number_name $r]');"
-}
-puts {COMMIT;}
-
-
-# 50 SELECTs on an integer comparison.  There is no index so
-# a full table scan is required.
-#
-for {set i 0} {$i<50} {incr i} {
-  set lwr [expr {$i*100}]
-  set upr [expr {($i+10)*100}]
-  puts "SELECT count(*), avg(b) FROM t1 WHERE b>=$lwr AND b<$upr;"
-}
-
-# 50 SELECTs on an LIKE comparison.  There is no index so a full
-# table scan is required.
-#
-for {set i 0} {$i<50} {incr i} {
-  puts "SELECT count(*), avg(b) FROM t1 WHERE c LIKE '%[number_name $i]%';"
-}
-
-# Create indices
-#
-puts {BEGIN;}
-puts {
-  CREATE INDEX i1a ON t1(a);
-  CREATE INDEX i1b ON t1(b);
-  CREATE INDEX i1c ON t1(c);
-}
-puts {COMMIT;}
-
-# 5000 SELECTs on an integer comparison where the integer is
-# indexed.
-#
-set sql {}
-for {set i 0} {$i<5000} {incr i} {
-  set lwr [expr {$i*100}]
-  set upr [expr {($i+10)*100}]
-  puts "SELECT count(*), avg(b) FROM t1 WHERE b>=$lwr AND b<$upr;"
-}
-
-# 100000 random SELECTs against rowid.
-#
-for {set i 1} {$i<=100000} {incr i} {
-  set id [expr {int(rand()*50000)+1}]
-  puts "SELECT c FROM t1 WHERE rowid=$id;"
-}
-
-# 100000 random SELECTs against a unique indexed column.
-#
-for {set i 1} {$i<=100000} {incr i} {
-  set id [expr {int(rand()*50000)+1}]
-  puts "SELECT c FROM t1 WHERE a=$id;"
-}
-
-# 50000 random SELECTs against an indexed column text column
-#
-set nt1c [llength $t1c_list]
-for {set i 0} {$i<50000} {incr i} {
-  set r [expr {int(rand()*$nt1c)}]
-  set c [lindex $t1c_list $i]
-  puts "SELECT c FROM t1 WHERE c='$c';"
-}
-
-
-# Vacuum
-puts {VACUUM;}
-
-# 5000 updates of ranges where the field being compared is indexed.
-#
-puts {BEGIN;}
-for {set i 0} {$i<5000} {incr i} {
-  set lwr [expr {$i*2}]
-  set upr [expr {($i+1)*2}]
-  puts "UPDATE t1 SET b=b*2 WHERE a>=$lwr AND a<$upr;"
-}
-puts {COMMIT;}
-
-# 50000 single-row updates.  An index is used to find the row quickly.
-#
-puts {BEGIN;}
-for {set i 0} {$i<50000} {incr i} {
-  set r [expr {int(rand()*500000)}]
-  puts "UPDATE t1 SET b=$r WHERE a=$i;"
-}
-puts {COMMIT;}
-
-# 1 big text update that touches every row in the table.
-#
-puts {
-  UPDATE t1 SET c=a;
-}
-
-# Many individual text updates.  Each row in the table is
-# touched through an index.
-#
-puts {BEGIN;}
-for {set i 1} {$i<=50000} {incr i} {
-  set r [expr {int(rand()*500000)}]
-  puts "UPDATE t1 SET c='[number_name $r]' WHERE a=$i;"
-}
-puts {COMMIT;}
-
-# Delete all content in a table.
-#
-puts {DELETE FROM t1;}
-
-# Copy one table into another
-#
-puts {INSERT INTO t1 SELECT * FROM t2;}
-
-# Delete all content in a table, one row at a time.
-#
-puts {DELETE FROM t1 WHERE 1;}
-
-# Refill the table yet again
-#
-puts {INSERT INTO t1 SELECT * FROM t2;}
-
-# Drop the table and recreate it without its indices.
-#
-puts {BEGIN;}
-puts {
-   DROP TABLE t1;
-   CREATE TABLE t1(a INTEGER, b INTEGER, c TEXT);
-}
-puts {COMMIT;}
-
-# Refill the table yet again.  This copy should be faster because
-# there are no indices to deal with.
-#
-puts {INSERT INTO t1 SELECT * FROM t2;}
-
-# Select 20000 rows from the table at random.
-#
-puts {
-  SELECT rowid FROM t1 ORDER BY random() LIMIT 20000;
-}
-
-# Delete 20000 random rows from the table.
-#
-puts {
-  DELETE FROM t1 WHERE rowid IN
-    (SELECT rowid FROM t1 ORDER BY random() LIMIT 20000);
-}
-puts {SELECT count(*) FROM t1;}
-    
-# Delete 20000 more rows at random from the table.
-#
-puts {
-  DELETE FROM t1 WHERE rowid IN
-    (SELECT rowid FROM t1 ORDER BY random() LIMIT 20000);
-}
-puts {SELECT count(*) FROM t1;}
diff --git a/tool/run-speed-test.sh b/tool/run-speed-test.sh
deleted file mode 100644 (file)
index 9c76465..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/bin/bash
-#
-# This is a template for a script used for day-to-day size and 
-# performance monitoring of SQLite.  Typical usage:
-#
-#     sh run-speed-test.sh trunk  #  Baseline measurement of trunk
-#     sh run-speed-test.sh x1     # Measure some experimental change
-#     fossil test-diff --tk cout-trunk.txt cout-x1.txt   # View changes
-#
-# There are multiple output files, all with a base name given by
-# the first argument:
-#
-#     summary-$BASE.txt           # Copy of standard output
-#     cout-$BASE.txt              # cachegrind output
-#     explain-$BASE.txt           # EXPLAIN listings (only with --explain)
-#
-if test "$1" = ""
-then
-  echo "Usage: $0 OUTPUTFILE [OPTIONS]"
-  exit
-fi
-NAME=$1
-shift
-CC_OPTS="-DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_MEMSYS5"
-SPEEDTEST_OPTS="--shrink-memory --reprepare --heap 10000000 64"
-SIZE=5
-doExplain=0
-while test "$1" != ""; do
-  case $1 in
-    --reprepare)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
-        ;;
-    --autovacuum)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
-        ;;
-    --utf16be)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
-        ;;
-    --stats)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
-        ;;
-    --without-rowid)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
-        ;;
-    --nomemstat)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
-        ;;
-    --wal)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS --journal wal"
-        ;;
-    --size)
-        shift; SIZE=$1
-        ;;
-    --explain)
-        doExplain=1
-        ;;
-    --heap)
-        CC_OPTS="$CC_OPTS -DSQLITE_ENABLE_MEMSYS5"
-        shift;
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS --heap $1 64"
-        ;;
-    *)
-        CC_OPTS="$CC_OPTS $1"
-        ;;
-  esac
-  shift
-done
-SPEEDTEST_OPTS="$SPEEDTEST_OPTS --size $SIZE"
-echo "NAME           = $NAME" | tee summary-$NAME.txt
-echo "SPEEDTEST_OPTS = $SPEEDTEST_OPTS" | tee -a summary-$NAME.txt
-echo "CC_OPTS        = $CC_OPTS" | tee -a summary-$NAME.txt
-rm -f cachegrind.out.* speedtest1 speedtest1.db sqlite3.o
-gcc -g -Os -Wall -I. $CC_OPTS -c sqlite3.c
-size sqlite3.o | tee -a summary-$NAME.txt
-if test $doExplain -eq 1; then
-  gcc -g -Os -Wall -I. $CC_OPTS \
-     -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
-    ./shell.c ./sqlite3.c -o sqlite3 -ldl -lpthread
-fi
-SRC=./speedtest1.c
-gcc -g -Os -Wall -I. $CC_OPTS $SRC ./sqlite3.o -o speedtest1 -ldl -lpthread
-ls -l speedtest1 | tee -a summary-$NAME.txt
-valgrind --tool=cachegrind ./speedtest1 speedtest1.db \
-    $SPEEDTEST_OPTS 2>&1 | tee -a summary-$NAME.txt
-size sqlite3.o | tee -a summary-$NAME.txt
-wc sqlite3.c
-cg_anno.tcl cachegrind.out.* >cout-$NAME.txt
-if test $doExplain -eq 1; then
-  ./speedtest1 --explain $SPEEDTEST_OPTS | ./sqlite3 >explain-$NAME.txt
-fi
diff --git a/tool/speed-check.sh b/tool/speed-check.sh
deleted file mode 100644 (file)
index fd122a1..0000000
+++ /dev/null
@@ -1,219 +0,0 @@
-#!/bin/bash
-#
-# This is a template for a script used for day-to-day size and 
-# performance monitoring of SQLite.  Typical usage:
-#
-#     sh speed-check.sh trunk  #  Baseline measurement of trunk
-#     sh speed-check.sh x1     # Measure some experimental change
-#     fossil xdiff --tk cout-trunk.txt cout-x1.txt   # View changes
-#
-# There are multiple output files, all with a base name given by
-# the first argument:
-#
-#     summary-$BASE.txt           # Copy of standard output
-#     cout-$BASE.txt              # cachegrind output
-#     explain-$BASE.txt           # EXPLAIN listings (only with --explain)
-#
-if test "$1" = ""
-then
-  echo "Usage: $0 OUTPUTFILE [OPTIONS]"
-  exit
-fi
-NAME=$1
-shift
-#CC_OPTS="-DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_MEMSYS5"
-CC_OPTS="-DSQLITE_ENABLE_MEMSYS5"
-CC=gcc
-SPEEDTEST_OPTS="--shrink-memory --reprepare --stats --heap 10000000 64"
-SIZE=5
-LEAN_OPTS="-DSQLITE_THREADSAFE=0"
-LEAN_OPTS="$LEAN_OPTS -DSQLITE_DEFAULT_MEMSTATUS=0"
-LEAN_OPTS="$LEAN_OPTS -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1"
-LEAN_OPTS="$LEAN_OPTS -DSQLITE_LIKE_DOESNT_MATCH_BLOBS"
-LEAN_OPTS="$LEAN_OPTS -DSQLITE_MAX_EXPR_DEPTH=0"
-LEAN_OPTS="$LEAN_OPTS -DSQLITE_OMIT_DECLTYPE"
-LEAN_OPTS="$LEAN_OPTS -DSQLITE_OMIT_DEPRECATED"
-LEAN_OPTS="$LEAN_OPTS -DSQLITE_OMIT_PROGRESS_CALLBACK"
-LEAN_OPTS="$LEAN_OPTS -DSQLITE_OMIT_SHARED_CACHE"
-LEAN_OPTS="$LEAN_OPTS -DSQLITE_USE_ALLOCA"
-BASELINE="trunk"
-doExplain=0
-doCachegrind=1
-doVdbeProfile=0
-doWal=1
-doDiff=1
-while test "$1" != ""; do
-  case $1 in
-    --nodiff)
-       doDiff=0
-        ;;
-    --reprepare)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
-        ;;
-    --autovacuum)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
-        ;;
-    --utf16be)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
-        ;;
-    --stats)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
-        ;;
-    --without-rowid)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
-        ;;
-    --strict)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
-        ;;
-    --nomemstat)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
-        ;;
-    --multithread)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
-        ;;
-    --singlethread)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
-        ;;
-    --serialized)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
-        ;;
-    --temp)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS --temp 6"
-        ;;
-    --legacy)
-       doWal=0
-        CC_OPTS="$CC_OPTS -DSPEEDTEST_OMIT_HASH"
-        ;;
-    --verify)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS --verify"
-        ;;
-    --wal)
-        doWal=1
-        ;;
-    --size)
-        shift; SIZE=$1
-        ;;
-    --cachesize)
-        shift; SPEEDTEST_OPTS="$SPEEDTEST_OPTS --cachesize $1"
-        ;;
-    --stmtcache)
-        shift; SPEEDTEST_OPTS="$SPEEDTEST_OPTS --stmtcache $1"
-        ;;
-    --checkpoint)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS --checkpoint"
-        ;;
-    --explain)
-        doExplain=1
-        ;;
-    --vdbeprofile)
-        rm -f vdbe_profile.out
-        CC_OPTS="$CC_OPTS -DVDBE_PROFILE"
-        doCachegrind=0
-        doVdbeProfile=1
-        ;;
-    --lean)
-        CC_OPTS="$CC_OPTS $LEAN_OPTS"
-        ;;
-    --clang)
-        CC=clang
-        ;;
-    --icc)
-        CC=/home/drh/intel/bin/icc
-        ;;
-    --gcc7)
-        CC=gcc-7
-        ;;
-    --heap)
-        CC_OPTS="$CC_OPTS -DSQLITE_ENABLE_MEMSYS5"
-        shift;
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS --heap $1 64"
-        ;;
-    --lookaside)
-        shift;
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS --lookaside $1 $2"
-        shift;
-        ;;
-    --repeat)
-        CC_OPTS="$CC_OPTS -DSQLITE_ENABLE_RCACHE"
-        shift;
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS --repeat $1"
-        ;;
-    --mmap)
-        shift;
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS --mmap $1"
-        ;;
-    --rtree)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS --testset rtree"
-        CC_OPTS="$CC_OPTS -DSQLITE_ENABLE_RTREE"
-        ;;
-    --persist)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS --persist"
-        ;;
-    --orm)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS --testset orm"
-        ;;
-    --cte)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS --testset cte"
-        ;;
-    --fp)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS --testset fp"
-        ;;
-    --parsenumber)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS --testset parsenumber"
-        ;;
-    --stmtscanstatus)
-        SPEEDTEST_OPTS="$SPEEDTEST_OPTS --stmtscanstatus"
-        ;;
-    -*)
-        CC_OPTS="$CC_OPTS $1"
-        ;;
-    *)
-       BASELINE=$1
-        ;;
-  esac
-  shift
-done
-if test $doWal -eq 1; then
-  SPEEDTEST_OPTS="$SPEEDTEST_OPTS --journal wal"
-fi
-SPEEDTEST_OPTS="$SPEEDTEST_OPTS --size $SIZE"
-echo "NAME           = $NAME" | tee summary-$NAME.txt
-echo "SPEEDTEST_OPTS = $SPEEDTEST_OPTS" | tee -a summary-$NAME.txt
-echo "CC_OPTS        = $CC_OPTS" | tee -a summary-$NAME.txt
-rm -f cachegrind.out.* speedtest1 speedtest1.db sqlite3.o
-if test $doVdbeProfile -eq 1; then
-  rm -f vdbe_profile.out
-fi
-$CC -g -Os -Wall -I. $CC_OPTS -c sqlite3.c
-size sqlite3.o | tee -a summary-$NAME.txt
-if test $doExplain -eq 1; then
-  $CC -g -Os -Wall -I. $CC_OPTS \
-     -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
-    ./shell.c ./sqlite3.c -o sqlite3 -ldl -lpthread
-fi
-SRC=./speedtest1.c
-$CC -g -Os -Wall -I. $CC_OPTS $SRC ./sqlite3.o -o speedtest1 -ldl -lpthread
-ls -l speedtest1 | tee -a summary-$NAME.txt
-if test $doCachegrind -eq 1; then
-  valgrind --tool=cachegrind ./speedtest1 speedtest1.db \
-      $SPEEDTEST_OPTS 2>&1 | tee -a summary-$NAME.txt
-else
-  ./speedtest1 speedtest1.db $SPEEDTEST_OPTS 2>&1 | tee -a summary-$NAME.txt
-fi
-size sqlite3.o | tee -a summary-$NAME.txt
-wc sqlite3.c
-if test $doCachegrind -eq 1; then
-  cg_anno.tcl cachegrind.out.* >cout-$NAME.txt
-  echo '*****************************************************' >>cout-$NAME.txt
-  sed 's/^[0-9=-]\{9\}/==00000==/' summary-$NAME.txt >>cout-$NAME.txt
-fi
-if test $doExplain -eq 1; then
-  ./speedtest1 --explain $SPEEDTEST_OPTS | ./sqlite3 >explain-$NAME.txt
-fi
-if test $doVdbeProfile -eq 1; then
-  tclsh ../sqlite/tool/vdbe_profile.tcl >vdbeprofile-$NAME.txt
-  open vdbeprofile-$NAME.txt
-fi
-if test "$NAME" != "$BASELINE" -a $doVdbeProfile -ne 1 -a $doDiff -ne 0; then
-  fossil test-diff --tk -c 20 cout-$BASELINE.txt cout-$NAME.txt
-fi
diff --git a/tool/speedtest.tcl b/tool/speedtest.tcl
deleted file mode 100644 (file)
index ef39dc5..0000000
+++ /dev/null
@@ -1,275 +0,0 @@
-#!/usr/bin/tclsh
-#
-# Run this script using TCLSH to do a speed comparison between
-# various versions of SQLite and PostgreSQL and MySQL
-#
-
-# Run a test
-#
-set cnt 1
-proc runtest {title} {
-  global cnt
-  set sqlfile test$cnt.sql
-  puts "<h2>Test $cnt: $title</h2>"
-  incr cnt
-  set fd [open $sqlfile r]
-  set sql [string trim [read $fd [file size $sqlfile]]]
-  close $fd
-  set sx [split $sql \n]
-  set n [llength $sx]
-  if {$n>8} {
-    set sql {}
-    for {set i 0} {$i<3} {incr i} {append sql [lindex $sx $i]<br>\n}
-    append sql  "<i>... [expr {$n-6}] lines omitted</i><br>\n"
-    for {set i [expr {$n-3}]} {$i<$n} {incr i} {
-      append sql [lindex $sx $i]<br>\n
-    }
-  } else {
-    regsub -all \n [string trim $sql] <br> sql
-  }
-  puts "<blockquote>"
-  puts "$sql"
-  puts "</blockquote><table border=0 cellpadding=0 cellspacing=0>"
-  set format {<tr><td>%s</td><td align="right">&nbsp;&nbsp;&nbsp;%.3f</td></tr>}
-  set delay 1000
-#  exec sync; after $delay;
-#  set t [time "exec psql drh <$sqlfile" 1]
-#  set t [expr {[lindex $t 0]/1000000.0}]
-#  puts [format $format PostgreSQL: $t]
-  exec sync; after $delay;
-  set t [time "exec mysql -f drh <$sqlfile" 1]
-  set t [expr {[lindex $t 0]/1000000.0}]
-  puts [format $format MySQL: $t]
-#  set t [time "exec ./sqlite232 s232.db <$sqlfile" 1]
-#  set t [expr {[lindex $t 0]/1000000.0}]
-#  puts [format $format {SQLite 2.3.2:} $t]
-#  set t [time "exec ./sqlite-100 s100.db <$sqlfile" 1]
-#  set t [expr {[lindex $t 0]/1000000.0}]
-#  puts [format $format {SQLite 2.4 (cache=100):} $t]
-  exec sync; after $delay;
-  set t [time "exec ./sqlite248 s2k.db <$sqlfile" 1]
-  set t [expr {[lindex $t 0]/1000000.0}]
-  puts [format $format {SQLite 2.4.8:} $t]
-  exec sync; after $delay;
-  set t [time "exec ./sqlite248 sns.db <$sqlfile" 1]
-  set t [expr {[lindex $t 0]/1000000.0}]
-  puts [format $format {SQLite 2.4.8 (nosync):} $t]
-  exec sync; after $delay;
-  set t [time "exec ./sqlite2412 s2kb.db <$sqlfile" 1]
-  set t [expr {[lindex $t 0]/1000000.0}]
-  puts [format $format {SQLite 2.4.12:} $t]
-  exec sync; after $delay;
-  set t [time "exec ./sqlite2412 snsb.db <$sqlfile" 1]
-  set t [expr {[lindex $t 0]/1000000.0}]
-  puts [format $format {SQLite 2.4.12 (nosync):} $t]
-#  set t [time "exec ./sqlite-t1 st1.db <$sqlfile" 1]
-#  set t [expr {[lindex $t 0]/1000000.0}]
-#  puts [format $format {SQLite 2.4 (test):} $t]
-  puts "</table>"
-}
-
-# Initialize the environment
-#
-expr srand(1)
-catch {exec /bin/sh -c {rm -f s*.db}}
-set fd [open clear.sql w]
-puts $fd {
-  drop table t1;
-  drop table t2;
-}
-close $fd
-catch {exec psql drh <clear.sql}
-catch {exec mysql drh <clear.sql}
-set fd [open 2kinit.sql w]
-puts $fd {
-  PRAGMA default_cache_size=2000;
-  PRAGMA default_synchronous=on;
-}
-close $fd
-exec ./sqlite248 s2k.db <2kinit.sql
-exec ./sqlite2412 s2kb.db <2kinit.sql
-set fd [open nosync-init.sql w]
-puts $fd {
-  PRAGMA default_cache_size=2000;
-  PRAGMA default_synchronous=off;
-}
-close $fd
-exec ./sqlite248 sns.db <nosync-init.sql
-exec ./sqlite2412 snsb.db <nosync-init.sql
-set ones {zero one two three four five six seven eight nine
-          ten eleven twelve thirteen fourteen fifteen sixteen seventeen
-          eighteen nineteen}
-set tens {{} ten twenty thirty forty fifty sixty seventy eighty ninety}
-proc number_name {n} {
-  if {$n>=1000} {
-    set txt "[number_name [expr {$n/1000}]] thousand"
-    set n [expr {$n%1000}]
-  } else {
-    set txt {}
-  }
-  if {$n>=100} {
-    append txt " [lindex $::ones [expr {$n/100}]] hundred"
-    set n [expr {$n%100}]
-  }
-  if {$n>=20} {
-    append txt " [lindex $::tens [expr {$n/10}]]"
-    set n [expr {$n%10}]
-  }
-  if {$n>0} {
-    append txt " [lindex $::ones $n]"
-  }
-  set txt [string trim $txt]
-  if {$txt==""} {set txt zero}
-  return $txt
-}
-
-
-
-set fd [open test$cnt.sql w]
-puts $fd "CREATE TABLE t1(a INTEGER, b INTEGER, c VARCHAR(100));"
-for {set i 1} {$i<=1000} {incr i} {
-  set r [expr {int(rand()*100000)}]
-  puts $fd "INSERT INTO t1 VALUES($i,$r,'[number_name $r]');"
-}
-close $fd
-runtest {1000 INSERTs}
-
-
-
-set fd [open test$cnt.sql w]
-puts $fd "BEGIN;"
-puts $fd "CREATE TABLE t2(a INTEGER, b INTEGER, c VARCHAR(100));"
-for {set i 1} {$i<=25000} {incr i} {
-  set r [expr {int(rand()*500000)}]
-  puts $fd "INSERT INTO t2 VALUES($i,$r,'[number_name $r]');"
-}
-puts $fd "COMMIT;"
-close $fd
-runtest {25000 INSERTs in a transaction}
-
-
-
-set fd [open test$cnt.sql w]
-for {set i 0} {$i<100} {incr i} {
-  set lwr [expr {$i*100}]
-  set upr [expr {($i+10)*100}]
-  puts $fd "SELECT count(*), avg(b) FROM t2 WHERE b>=$lwr AND b<$upr;"
-}
-close $fd
-runtest {100 SELECTs without an index}
-
-
-
-set fd [open test$cnt.sql w]
-for {set i 1} {$i<=100} {incr i} {
-  puts $fd "SELECT count(*), avg(b) FROM t2 WHERE c LIKE '%[number_name $i]%';"
-}
-close $fd
-runtest {100 SELECTs on a string comparison}
-
-
-
-set fd [open test$cnt.sql w]
-puts $fd {CREATE INDEX i2a ON t2(a);}
-puts $fd {CREATE INDEX i2b ON t2(b);}
-close $fd
-runtest {Creating an index}
-
-
-
-set fd [open test$cnt.sql w]
-for {set i 0} {$i<5000} {incr i} {
-  set lwr [expr {$i*100}]
-  set upr [expr {($i+1)*100}]
-  puts $fd "SELECT count(*), avg(b) FROM t2 WHERE b>=$lwr AND b<$upr;"
-}
-close $fd
-runtest {5000 SELECTs with an index}
-
-
-
-set fd [open test$cnt.sql w]
-puts $fd "BEGIN;"
-for {set i 0} {$i<1000} {incr i} {
-  set lwr [expr {$i*10}]
-  set upr [expr {($i+1)*10}]
-  puts $fd "UPDATE t1 SET b=b*2 WHERE a>=$lwr AND a<$upr;"
-}
-puts $fd "COMMIT;"
-close $fd
-runtest {1000 UPDATEs without an index}
-
-
-
-set fd [open test$cnt.sql w]
-puts $fd "BEGIN;"
-for {set i 1} {$i<=25000} {incr i} {
-  set r [expr {int(rand()*500000)}]
-  puts $fd "UPDATE t2 SET b=$r WHERE a=$i;"
-}
-puts $fd "COMMIT;"
-close $fd
-runtest {25000 UPDATEs with an index}
-
-
-set fd [open test$cnt.sql w]
-puts $fd "BEGIN;"
-for {set i 1} {$i<=25000} {incr i} {
-  set r [expr {int(rand()*500000)}]
-  puts $fd "UPDATE t2 SET c='[number_name $r]' WHERE a=$i;"
-}
-puts $fd "COMMIT;"
-close $fd
-runtest {25000 text UPDATEs with an index}
-
-
-
-set fd [open test$cnt.sql w]
-puts $fd "BEGIN;"
-puts $fd "INSERT INTO t1 SELECT * FROM t2;"
-puts $fd "INSERT INTO t2 SELECT * FROM t1;"
-puts $fd "COMMIT;"
-close $fd
-runtest {INSERTs from a SELECT}
-
-
-
-set fd [open test$cnt.sql w]
-puts $fd {DELETE FROM t2 WHERE c LIKE '%fifty%';}
-close $fd
-runtest {DELETE without an index}
-
-
-
-set fd [open test$cnt.sql w]
-puts $fd {DELETE FROM t2 WHERE a>10 AND a<20000;}
-close $fd
-runtest {DELETE with an index}
-
-
-
-set fd [open test$cnt.sql w]
-puts $fd {INSERT INTO t2 SELECT * FROM t1;}
-close $fd
-runtest {A big INSERT after a big DELETE}
-
-
-
-set fd [open test$cnt.sql w]
-puts $fd {BEGIN;}
-puts $fd {DELETE FROM t1;}
-for {set i 1} {$i<=3000} {incr i} {
-  set r [expr {int(rand()*100000)}]
-  puts $fd "INSERT INTO t1 VALUES($i,$r,'[number_name $r]');"
-}
-puts $fd {COMMIT;}
-close $fd
-runtest {A big DELETE followed by many small INSERTs}
-
-
-
-set fd [open test$cnt.sql w]
-puts $fd {DROP TABLE t1;}
-puts $fd {DROP TABLE t2;}
-close $fd
-runtest {DROP TABLE}
diff --git a/tool/speedtest16.c b/tool/speedtest16.c
deleted file mode 100644 (file)
index 993cc19..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
-** Performance test for SQLite.
-**
-** This program reads ASCII text from a file named on the command-line.
-** It converts each SQL statement into UTF16 and submits it to SQLite
-** for evaluation.  A new UTF16 database is created at the beginning of
-** the program.  All statements are timed using the high-resolution timer
-** built into Intel-class processors.
-**
-** To compile this program, first compile the SQLite library separately
-** will full optimizations.  For example:
-**
-**     gcc -c -O6 -DSQLITE_THREADSAFE=0 sqlite3.c
-**
-** Then link against this program.  But to do optimize this program
-** because that defeats the hi-res timer.
-**
-**     gcc speedtest16.c sqlite3.o -ldl -I../src
-**
-** Then run this program with a single argument which is the name of
-** a file containing SQL script that you want to test:
-**
-**     ./a.out database.db test.sql
-*/
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <unistd.h>
-#include "sqlite3.h"
-
-#define ISSPACE(X)  isspace((unsigned char)(X))
-
-/* 
-** hwtime.h contains inline assembler code for implementing 
-** high-performance timing routines.
-*/
-#include "hwtime.h"
-
-/*
-** Convert a zero-terminated ASCII string into a zero-terminated
-** UTF-16le string.  Memory to hold the returned string comes 
-** from malloc() and should be freed by the caller.
-*/
-static void *asciiToUtf16le(const char *z){
-  int n = strlen(z);
-  char *z16;
-  int i, j;
-
-  z16 = malloc( n*2 + 2 );
-  for(i=j=0; i<=n; i++){
-    z16[j++] = z[i];
-    z16[j++] = 0;
-  }
-  return (void*)z16;
-}
-
-/*
-** Timers
-*/
-static sqlite_uint64 prepTime = 0;
-static sqlite_uint64 runTime = 0;
-static sqlite_uint64 finalizeTime = 0;
-
-/*
-** Prepare and run a single statement of SQL.
-*/
-static void prepareAndRun(sqlite3 *db, const char *zSql){
-  void *utf16;
-  sqlite3_stmt *pStmt;
-  const void *stmtTail;
-  sqlite_uint64 iStart, iElapse;
-  int rc;
-  
-  printf("****************************************************************\n");
-  printf("SQL statement: [%s]\n", zSql);
-  utf16 = asciiToUtf16le(zSql);
-  iStart = sqlite3Hwtime();
-  rc = sqlite3_prepare16_v2(db, utf16, -1, &pStmt, &stmtTail);
-  iElapse = sqlite3Hwtime() - iStart;
-  prepTime += iElapse;
-  printf("sqlite3_prepare16_v2() returns %d in %llu cycles\n", rc, iElapse);
-  if( rc==SQLITE_OK ){
-    int nRow = 0;
-    iStart = sqlite3Hwtime();
-    while( (rc=sqlite3_step(pStmt))==SQLITE_ROW ){ nRow++; }
-    iElapse = sqlite3Hwtime() - iStart;
-    runTime += iElapse;
-    printf("sqlite3_step() returns %d after %d rows in %llu cycles\n",
-           rc, nRow, iElapse);
-    iStart = sqlite3Hwtime();
-    rc = sqlite3_finalize(pStmt);
-    iElapse = sqlite3Hwtime() - iStart;
-    finalizeTime += iElapse;
-    printf("sqlite3_finalize() returns %d in %llu cycles\n", rc, iElapse);
-  }
-  free(utf16);
-}
-
-int main(int argc, char **argv){
-  void *utf16;
-  sqlite3 *db;
-  int rc;
-  int nSql;
-  char *zSql;
-  int i, j;
-  FILE *in;
-  sqlite_uint64 iStart, iElapse;
-  sqlite_uint64 iSetup = 0;
-  int nStmt = 0;
-  int nByte = 0;
-
-  if( argc!=3 ){
-    fprintf(stderr, "Usage: %s FILENAME SQL-SCRIPT\n"
-                    "Runs SQL-SCRIPT as UTF16 against a UTF16 database\n",
-                    argv[0]);
-    exit(1);
-  }
-  in = fopen(argv[2], "r");
-  fseek(in, 0L, SEEK_END);
-  nSql = ftell(in);
-  zSql = malloc( nSql+1 );
-  fseek(in, 0L, SEEK_SET);
-  nSql = fread(zSql, 1, nSql, in);
-  zSql[nSql] = 0;
-
-  printf("SQLite version: %d\n", sqlite3_libversion_number());
-  unlink(argv[1]);
-  utf16 = asciiToUtf16le(argv[1]);
-  iStart = sqlite3Hwtime();
-  rc = sqlite3_open16(utf16, &db);
-  iElapse = sqlite3Hwtime() - iStart;
-  iSetup = iElapse;
-  printf("sqlite3_open16() returns %d in %llu cycles\n", rc, iElapse);
-  free(utf16);
-  for(i=j=0; j<nSql; j++){
-    if( zSql[j]==';' ){
-      int isComplete;
-      char c = zSql[j+1];
-      zSql[j+1] = 0;
-      isComplete = sqlite3_complete(&zSql[i]);
-      zSql[j+1] = c;
-      if( isComplete ){
-        zSql[j] = 0;
-        while( i<j && ISSPACE(zSql[i]) ){ i++; }
-        if( i<j ){
-          nStmt++;
-          nByte += j-i;
-          prepareAndRun(db, &zSql[i]);
-        }
-        zSql[j] = ';';
-        i = j+1;
-      }
-    }
-  }
-  iStart = sqlite3Hwtime();
-  sqlite3_close(db);
-  iElapse = sqlite3Hwtime() - iStart;
-  iSetup += iElapse;
-  printf("sqlite3_close() returns in %llu cycles\n", iElapse);
-  printf("\n");
-  printf("Statements run:       %15d\n", nStmt);
-  printf("Bytes of SQL text:    %15d\n", nByte);
-  printf("Total prepare time:   %15llu cycles\n", prepTime);
-  printf("Total run time:       %15llu cycles\n", runTime);
-  printf("Total finalize time:  %15llu cycles\n", finalizeTime);
-  printf("Open/Close time:      %15llu cycles\n", iSetup);
-  printf("Total Time:           %15llu cycles\n",
-      prepTime + runTime + finalizeTime + iSetup);
-  return 0;
-}
diff --git a/tool/speedtest2.tcl b/tool/speedtest2.tcl
deleted file mode 100644 (file)
index 4fd632d..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-#!/usr/bin/tclsh
-#
-# Run this script using TCLSH to do a speed comparison between
-# various versions of SQLite and PostgreSQL and MySQL
-#
-
-# Run a test
-#
-set cnt 1
-proc runtest {title} {
-  global cnt
-  set sqlfile test$cnt.sql
-  puts "<h2>Test $cnt: $title</h2>"
-  incr cnt
-  set fd [open $sqlfile r]
-  set sql [string trim [read $fd [file size $sqlfile]]]
-  close $fd
-  set sx [split $sql \n]
-  set n [llength $sx]
-  if {$n>8} {
-    set sql {}
-    for {set i 0} {$i<3} {incr i} {append sql [lindex $sx $i]<br>\n}
-    append sql  "<i>... [expr {$n-6}] lines omitted</i><br>\n"
-    for {set i [expr {$n-3}]} {$i<$n} {incr i} {
-      append sql [lindex $sx $i]<br>\n
-    }
-  } else {
-    regsub -all \n [string trim $sql] <br> sql
-  }
-  puts "<blockquote>"
-  puts "$sql"
-  puts "</blockquote><table border=0 cellpadding=0 cellspacing=0>"
-  set format {<tr><td>%s</td><td align="right">&nbsp;&nbsp;&nbsp;%.3f</td></tr>}
-  set delay 1000
-  exec sync; after $delay;
-  set t [time "exec psql drh <$sqlfile" 1]
-  set t [expr {[lindex $t 0]/1000000.0}]
-  puts [format $format PostgreSQL: $t]
-  exec sync; after $delay;
-  set t [time "exec mysql -f drh <$sqlfile" 1]
-  set t [expr {[lindex $t 0]/1000000.0}]
-  puts [format $format MySQL: $t]
-#  set t [time "exec ./sqlite232 s232.db <$sqlfile" 1]
-#  set t [expr {[lindex $t 0]/1000000.0}]
-#  puts [format $format {SQLite 2.3.2:} $t]
-#  set t [time "exec ./sqlite-100 s100.db <$sqlfile" 1]
-#  set t [expr {[lindex $t 0]/1000000.0}]
-#  puts [format $format {SQLite 2.4 (cache=100):} $t]
-  exec sync; after $delay;
-  set t [time "exec ./sqlite240 s2k.db <$sqlfile" 1]
-  set t [expr {[lindex $t 0]/1000000.0}]
-  puts [format $format {SQLite 2.4:} $t]
-  exec sync; after $delay;
-  set t [time "exec ./sqlite240 sns.db <$sqlfile" 1]
-  set t [expr {[lindex $t 0]/1000000.0}]
-  puts [format $format {SQLite 2.4 (nosync):} $t]
-#  set t [time "exec ./sqlite-t1 st1.db <$sqlfile" 1]
-#  set t [expr {[lindex $t 0]/1000000.0}]
-#  puts [format $format {SQLite 2.4 (test):} $t]
-  puts "</table>"
-}
-
-# Initialize the environment
-#
-expr srand(1)
-catch {exec /bin/sh -c {rm -f s*.db}}
-set fd [open clear.sql w]
-puts $fd {
-  drop table t1;
-  drop table t2;
-}
-close $fd
-catch {exec psql drh <clear.sql}
-catch {exec mysql drh <clear.sql}
-set fd [open 2kinit.sql w]
-puts $fd {
-  PRAGMA default_cache_size=2000;
-  PRAGMA default_synchronous=on;
-}
-close $fd
-exec ./sqlite240 s2k.db <2kinit.sql
-exec ./sqlite-t1 st1.db <2kinit.sql
-set fd [open nosync-init.sql w]
-puts $fd {
-  PRAGMA default_cache_size=2000;
-  PRAGMA default_synchronous=off;
-}
-close $fd
-exec ./sqlite240 sns.db <nosync-init.sql
-set ones {zero one two three four five six seven eight nine
-          ten eleven twelve thirteen fourteen fifteen sixteen seventeen
-          eighteen nineteen}
-set tens {{} ten twenty thirty forty fifty sixty seventy eighty ninety}
-proc number_name {n} {
-  if {$n>=1000} {
-    set txt "[number_name [expr {$n/1000}]] thousand"
-    set n [expr {$n%1000}]
-  } else {
-    set txt {}
-  }
-  if {$n>=100} {
-    append txt " [lindex $::ones [expr {$n/100}]] hundred"
-    set n [expr {$n%100}]
-  }
-  if {$n>=20} {
-    append txt " [lindex $::tens [expr {$n/10}]]"
-    set n [expr {$n%10}]
-  }
-  if {$n>0} {
-    append txt " [lindex $::ones $n]"
-  }
-  set txt [string trim $txt]
-  if {$txt==""} {set txt zero}
-  return $txt
-}
-
-
-set fd [open test$cnt.sql w]
-puts $fd "BEGIN;"
-puts $fd "CREATE TABLE t1(a INTEGER, b INTEGER, c VARCHAR(100));"
-for {set i 1} {$i<=25000} {incr i} {
-  set r [expr {int(rand()*500000)}]
-  puts $fd "INSERT INTO t1 VALUES($i,$r,'[number_name $r]');"
-}
-puts $fd "COMMIT;"
-close $fd
-runtest {25000 INSERTs in a transaction}
-
-
-set fd [open test$cnt.sql w]
-puts $fd "DELETE FROM t1;"
-close $fd
-runtest {DELETE everything}
-
-
-set fd [open test$cnt.sql w]
-puts $fd "BEGIN;"
-for {set i 1} {$i<=25000} {incr i} {
-  set r [expr {int(rand()*500000)}]
-  puts $fd "INSERT INTO t1 VALUES($i,$r,'[number_name $r]');"
-}
-puts $fd "COMMIT;"
-close $fd
-runtest {25000 INSERTs in a transaction}
-
-
-set fd [open test$cnt.sql w]
-puts $fd "DELETE FROM t1;"
-close $fd
-runtest {DELETE everything}
-
-
-set fd [open test$cnt.sql w]
-puts $fd "BEGIN;"
-for {set i 1} {$i<=25000} {incr i} {
-  set r [expr {int(rand()*500000)}]
-  puts $fd "INSERT INTO t1 VALUES($i,$r,'[number_name $r]');"
-}
-puts $fd "COMMIT;"
-close $fd
-runtest {25000 INSERTs in a transaction}
-
-
-set fd [open test$cnt.sql w]
-puts $fd "DELETE FROM t1;"
-close $fd
-runtest {DELETE everything}
-
-
-set fd [open test$cnt.sql w]
-puts $fd "BEGIN;"
-for {set i 1} {$i<=25000} {incr i} {
-  set r [expr {int(rand()*500000)}]
-  puts $fd "INSERT INTO t1 VALUES($i,$r,'[number_name $r]');"
-}
-puts $fd "COMMIT;"
-close $fd
-runtest {25000 INSERTs in a transaction}
-
-
-set fd [open test$cnt.sql w]
-puts $fd "DELETE FROM t1;"
-close $fd
-runtest {DELETE everything}
-
-
-set fd [open test$cnt.sql w]
-puts $fd "BEGIN;"
-for {set i 1} {$i<=25000} {incr i} {
-  set r [expr {int(rand()*500000)}]
-  puts $fd "INSERT INTO t1 VALUES($i,$r,'[number_name $r]');"
-}
-puts $fd "COMMIT;"
-close $fd
-runtest {25000 INSERTs in a transaction}
-
-
-set fd [open test$cnt.sql w]
-puts $fd "DELETE FROM t1;"
-close $fd
-runtest {DELETE everything}
-
-
-set fd [open test$cnt.sql w]
-puts $fd {DROP TABLE t1;}
-close $fd
-runtest {DROP TABLE}
diff --git a/tool/speedtest8.c b/tool/speedtest8.c
deleted file mode 100644 (file)
index 051fc89..0000000
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
-** Performance test for SQLite.
-**
-** This program reads ASCII text from a file named on the command-line
-** and submits that text  to SQLite for evaluation.  A new database
-** is created at the beginning of the program.  All statements are
-** timed using the high-resolution timer built into Intel-class processors.
-**
-** To compile this program, first compile the SQLite library separately
-** will full optimizations.  For example:
-**
-**     gcc -c -O6 -DSQLITE_THREADSAFE=0 sqlite3.c
-**
-** Then link against this program.  But to do optimize this program
-** because that defeats the hi-res timer.
-**
-**     gcc speedtest8.c sqlite3.o -ldl -I../src
-**
-** Then run this program with a single argument which is the name of
-** a file containing SQL script that you want to test:
-**
-**     ./a.out test.db  test.sql
-*/
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <time.h>
-
-#if defined(_MSC_VER)
-#include <windows.h>
-#else
-#include <unistd.h>
-#include <sys/times.h>
-#include <sched.h>
-#endif
-
-#include "sqlite3.h"
-
-/* 
-** hwtime.h contains inline assembler code for implementing 
-** high-performance timing routines.
-*/
-#include "hwtime.h"
-
-/*
-** Timers
-*/
-static sqlite_uint64 prepTime = 0;
-static sqlite_uint64 runTime = 0;
-static sqlite_uint64 finalizeTime = 0;
-
-/*
-** Prepare and run a single statement of SQL.
-*/
-static void prepareAndRun(sqlite3 *db, const char *zSql, int bQuiet){
-  sqlite3_stmt *pStmt;
-  const char *stmtTail;
-  sqlite_uint64 iStart, iElapse;
-  int rc;
-  
-  if (!bQuiet){
-    printf("***************************************************************\n");
-  }
-  if (!bQuiet) printf("SQL statement: [%s]\n", zSql);
-  iStart = sqlite3Hwtime();
-  rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &stmtTail);
-  iElapse = sqlite3Hwtime() - iStart;
-  prepTime += iElapse;
-  if (!bQuiet){
-    printf("sqlite3_prepare_v2() returns %d in %llu cycles\n", rc, iElapse);
-  }
-  if( rc==SQLITE_OK ){
-    int nRow = 0;
-    iStart = sqlite3Hwtime();
-    while( (rc=sqlite3_step(pStmt))==SQLITE_ROW ){ nRow++; }
-    iElapse = sqlite3Hwtime() - iStart;
-    runTime += iElapse;
-    if (!bQuiet){
-      printf("sqlite3_step() returns %d after %d rows in %llu cycles\n",
-             rc, nRow, iElapse);
-    }
-    iStart = sqlite3Hwtime();
-    rc = sqlite3_finalize(pStmt);
-    iElapse = sqlite3Hwtime() - iStart;
-    finalizeTime += iElapse;
-    if (!bQuiet){
-      printf("sqlite3_finalize() returns %d in %llu cycles\n", rc, iElapse);
-    }
-  }
-}
-
-int main(int argc, char **argv){
-  sqlite3 *db;
-  int rc;
-  int nSql;
-  char *zSql;
-  int i, j;
-  FILE *in;
-  sqlite_uint64 iStart, iElapse;
-  sqlite_uint64 iSetup = 0;
-  int nStmt = 0;
-  int nByte = 0;
-  const char *zArgv0 = argv[0];
-  int bQuiet = 0;
-#if !defined(_MSC_VER)
-  struct tms tmsStart, tmsEnd;
-  clock_t clkStart, clkEnd;
-#endif
-
-#ifdef HAVE_OSINST
-  extern sqlite3_vfs *sqlite3_instvfs_binarylog(char *, char *, char *);
-  extern void sqlite3_instvfs_destroy(sqlite3_vfs *);
-  sqlite3_vfs *pVfs = 0;
-#endif
-
-  while (argc>3)
-  {
-#ifdef HAVE_OSINST
-    if( argc>4 && (strcmp(argv[1], "-log")==0) ){
-     pVfs = sqlite3_instvfs_binarylog("oslog", 0, argv[2]);
-     sqlite3_vfs_register(pVfs, 1);
-     argv += 2;
-     argc -= 2;
-     continue;
-    }
-#endif
-
-    /*
-    ** Increasing the priority slightly above normal can help with
-    ** repeatability of testing.  Note that with Cygwin, -5 equates
-    ** to "High", +5 equates to "Low", and anything in between
-    ** equates to "Normal".
-    */
-    if( argc>4 && (strcmp(argv[1], "-priority")==0) ){
-#if defined(_MSC_VER)
-      int new_priority = atoi(argv[2]);
-      if(!SetPriorityClass(GetCurrentProcess(), 
-        (new_priority<=-5) ? HIGH_PRIORITY_CLASS : 
-        (new_priority<=0)  ? ABOVE_NORMAL_PRIORITY_CLASS : 
-        (new_priority==0)  ? NORMAL_PRIORITY_CLASS : 
-        (new_priority<5)   ? BELOW_NORMAL_PRIORITY_CLASS : 
-        IDLE_PRIORITY_CLASS)){
-        printf ("error setting priority\n"); 
-        exit(2); 
-      }
-#else
-      struct sched_param myParam;
-      sched_getparam(0, &myParam);
-      printf ("Current process priority is %d.\n", (int)myParam.sched_priority); 
-      myParam.sched_priority = atoi(argv[2]);
-      printf ("Setting process priority to %d.\n", (int)myParam.sched_priority); 
-      if (sched_setparam (0, &myParam) != 0){
-        printf ("error setting priority\n"); 
-        exit(2); 
-      }
-#endif
-      argv += 2;
-      argc -= 2;
-      continue;
-    }
-
-    if( argc>3 && strcmp(argv[1], "-quiet")==0 ){
-     bQuiet = -1;
-     argv++;
-     argc--;
-     continue;
-    }
-
-    break;
-  }
-
-  if( argc!=3 ){
-   fprintf(stderr, "Usage: %s [options] FILENAME SQL-SCRIPT\n"
-              "Runs SQL-SCRIPT against a UTF8 database\n"
-              "\toptions:\n"
-#ifdef HAVE_OSINST
-              "\t-log <log>\n"
-#endif
-              "\t-priority <value> : set priority of task\n"
-              "\t-quiet : only display summary results\n",
-              zArgv0);
-   exit(1);
-  }
-
-  in = fopen(argv[2], "r");
-  fseek(in, 0L, SEEK_END);
-  nSql = ftell(in);
-  zSql = malloc( nSql+1 );
-  fseek(in, 0L, SEEK_SET);
-  nSql = fread(zSql, 1, nSql, in);
-  zSql[nSql] = 0;
-
-  printf("SQLite version: %d\n", sqlite3_libversion_number());
-  unlink(argv[1]);
-#if !defined(_MSC_VER)
-  clkStart = times(&tmsStart);
-#endif
-  iStart = sqlite3Hwtime();
-  rc = sqlite3_open(argv[1], &db);
-  iElapse = sqlite3Hwtime() - iStart;
-  iSetup = iElapse;
-  if (!bQuiet) printf("sqlite3_open() returns %d in %llu cycles\n", rc, iElapse);
-  for(i=j=0; j<nSql; j++){
-    if( zSql[j]==';' ){
-      int isComplete;
-      char c = zSql[j+1];
-      zSql[j+1] = 0;
-      isComplete = sqlite3_complete(&zSql[i]);
-      zSql[j+1] = c;
-      if( isComplete ){
-        zSql[j] = 0;
-        while( i<j && isspace(zSql[i]) ){ i++; }
-        if( i<j ){
-          int n = j - i;
-          if( n>=6 && memcmp(&zSql[i], ".crash",6)==0 ) exit(1);
-          nStmt++;
-          nByte += n;
-          prepareAndRun(db, &zSql[i], bQuiet);
-        }
-        zSql[j] = ';';
-        i = j+1;
-      }
-    }
-  }
-  iStart = sqlite3Hwtime();
-  sqlite3_close(db);
-  iElapse = sqlite3Hwtime() - iStart;
-#if !defined(_MSC_VER)
-  clkEnd = times(&tmsEnd);
-#endif
-  iSetup += iElapse;
-  if (!bQuiet) printf("sqlite3_close() returns in %llu cycles\n", iElapse);
-
-  printf("\n");
-  printf("Statements run:        %15d stmts\n", nStmt);
-  printf("Bytes of SQL text:     %15d bytes\n", nByte);
-  printf("Total prepare time:    %15llu cycles\n", prepTime);
-  printf("Total run time:        %15llu cycles\n", runTime);
-  printf("Total finalize time:   %15llu cycles\n", finalizeTime);
-  printf("Open/Close time:       %15llu cycles\n", iSetup);
-  printf("Total time:            %15llu cycles\n",
-      prepTime + runTime + finalizeTime + iSetup);
-
-#if !defined(_MSC_VER)
-  printf("\n");
-  printf("Total user CPU time:   %15.3g secs\n", (tmsEnd.tms_utime - tmsStart.tms_utime)/(double)CLOCKS_PER_SEC );
-  printf("Total system CPU time: %15.3g secs\n", (tmsEnd.tms_stime - tmsStart.tms_stime)/(double)CLOCKS_PER_SEC );
-  printf("Total real time:       %15.3g secs\n", (clkEnd -clkStart)/(double)CLOCKS_PER_SEC );
-#endif
-
-#ifdef HAVE_OSINST
-  if( pVfs ){
-    sqlite3_instvfs_destroy(pVfs);
-    printf("vfs log written to %s\n", argv[0]);
-  }
-#endif
-
-  return 0;
-}
diff --git a/tool/speedtest8inst1.c b/tool/speedtest8inst1.c
deleted file mode 100644 (file)
index ceaeca0..0000000
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
-** Performance test for SQLite.
-**
-** This program reads ASCII text from a file named on the command-line
-** and submits that text  to SQLite for evaluation.  A new database
-** is created at the beginning of the program.  All statements are
-** timed using the high-resolution timer built into Intel-class processors.
-**
-** To compile this program, first compile the SQLite library separately
-** will full optimizations.  For example:
-**
-**     gcc -c -O6 -DSQLITE_THREADSAFE=0 sqlite3.c
-**
-** Then link against this program.  But to do optimize this program
-** because that defeats the hi-res timer.
-**
-**     gcc speedtest8.c sqlite3.o -ldl -I../src
-**
-** Then run this program with a single argument which is the name of
-** a file containing SQL script that you want to test:
-**
-**     ./a.out test.db  test.sql
-*/
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <unistd.h>
-#include <stdarg.h>
-#include "sqlite3.h"
-
-#define ISSPACE(X)  isspace((unsigned char)(X))
-
-#include "test_osinst.c"
-
-/*
-** Prepare and run a single statement of SQL.
-*/
-static void prepareAndRun(sqlite3_vfs *pInstVfs, sqlite3 *db, const char *zSql){
-  sqlite3_stmt *pStmt;
-  const char *stmtTail;
-  int rc;
-  char zMessage[1024];
-  zMessage[1023] = '\0';
-
-  sqlite3_uint64 iTime;
-
-  sqlite3_snprintf(1023, zMessage, "sqlite3_prepare_v2: %s", zSql);
-  sqlite3_instvfs_binarylog_marker(pInstVfs, zMessage);
-
-  iTime = sqlite3Hwtime();
-  rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &stmtTail);
-  iTime = sqlite3Hwtime() - iTime;
-  sqlite3_instvfs_binarylog_call(pInstVfs,BINARYLOG_PREPARE_V2,iTime,rc,zSql);
-
-  if( rc==SQLITE_OK ){
-    int nRow = 0;
-
-    sqlite3_snprintf(1023, zMessage, "sqlite3_step loop: %s", zSql);
-    sqlite3_instvfs_binarylog_marker(pInstVfs, zMessage);
-    iTime = sqlite3Hwtime();
-    while( (rc=sqlite3_step(pStmt))==SQLITE_ROW ){ nRow++; }
-    iTime = sqlite3Hwtime() - iTime;
-    sqlite3_instvfs_binarylog_call(pInstVfs, BINARYLOG_STEP, iTime, rc, zSql);
-
-    sqlite3_snprintf(1023, zMessage, "sqlite3_finalize: %s", zSql);
-    sqlite3_instvfs_binarylog_marker(pInstVfs, zMessage);
-    iTime = sqlite3Hwtime();
-    rc = sqlite3_finalize(pStmt);
-    iTime = sqlite3Hwtime() - iTime;
-    sqlite3_instvfs_binarylog_call(pInstVfs, BINARYLOG_FINALIZE, iTime, rc, zSql);
-  }
-}
-
-static int stringcompare(const char *zLeft, const char *zRight){
-  int ii;
-  for(ii=0; zLeft[ii] && zRight[ii]; ii++){
-    if( zLeft[ii]!=zRight[ii] ) return 0;
-  }
-  return( zLeft[ii]==zRight[ii] );
-}
-
-static char *readScriptFile(const char *zFile, int *pnScript){
-  sqlite3_vfs *pVfs = sqlite3_vfs_find(0);
-  sqlite3_file *p;
-  int rc;
-  sqlite3_int64 nByte;
-  char *zData = 0;
-  int flags = SQLITE_OPEN_READONLY|SQLITE_OPEN_MAIN_DB;
-
-  p = (sqlite3_file *)malloc(pVfs->szOsFile);
-  rc = pVfs->xOpen(pVfs, zFile, p, flags, &flags);
-  if( rc!=SQLITE_OK ){
-    goto error_out;
-  }
-
-  rc = p->pMethods->xFileSize(p, &nByte);
-  if( rc!=SQLITE_OK ){
-    goto close_out;
-  }
-
-  zData = (char *)malloc(nByte+1);
-  rc = p->pMethods->xRead(p, zData, nByte, 0);
-  if( rc!=SQLITE_OK ){
-    goto close_out;
-  }
-  zData[nByte] = '\0';
-
-  p->pMethods->xClose(p);
-  free(p);
-  *pnScript = nByte;
-  return zData;
-
-close_out:
-  p->pMethods->xClose(p);
-
-error_out:
-  free(p);
-  free(zData);
-  return 0;
-}
-
-int main(int argc, char **argv){
-
-  const char zUsageMsg[] = 
-    "Usage: %s options...\n"
-    "  where available options are:\n"
-    "\n"
-    "    -db      DATABASE-FILE  (database file to operate on)\n"
-    "    -script  SCRIPT-FILE    (script file to read sql from)\n"
-    "    -log     LOG-FILE       (log file to create)\n"
-    "    -logdata                (log all data to log file)\n"
-    "\n"
-    "  Options -db, -script and -log are compulsory\n"
-    "\n"
-  ;
-
-  const char *zDb = 0;
-  const char *zScript = 0;
-  const char *zLog = 0;
-  int logdata = 0;
-
-  int ii;
-  int i, j;
-  int rc;
-
-  sqlite3_vfs *pInstVfs;                 /* Instrumentation VFS */
-
-  char *zSql = 0;
-  int nSql;
-
-  sqlite3 *db;
-
-  for(ii=1; ii<argc; ii++){
-    if( stringcompare("-db", argv[ii]) && (ii+1)<argc ){
-      zDb = argv[++ii];
-    }
-
-    else if( stringcompare("-script", argv[ii]) && (ii+1)<argc ){
-      zScript = argv[++ii];
-    }
-
-    else if( stringcompare("-log", argv[ii]) && (ii+1)<argc ){
-      zLog = argv[++ii];
-    }
-
-    else if( stringcompare("-logdata", argv[ii]) ){
-      logdata = 1;
-    }
-
-    else {
-      goto usage;
-    }
-  }
-  if( !zDb || !zScript || !zLog ) goto usage;
-
-  zSql = readScriptFile(zScript, &nSql);
-  if( !zSql ){
-    fprintf(stderr, "Failed to read script file\n");
-    return -1;
-  }
-
-  pInstVfs = sqlite3_instvfs_binarylog("logging", 0, zLog, logdata);
-
-  rc = sqlite3_open_v2(
-     zDb, &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, "logging"
-  );
-  if( rc!=SQLITE_OK ){
-    fprintf(stderr, "Failed to open db: %s\n", sqlite3_errmsg(db));
-    return -2;
-  }
-
-  for(i=j=0; j<nSql; j++){
-    if( zSql[j]==';' ){
-      int isComplete;
-      char c = zSql[j+1];
-      zSql[j+1] = 0;
-      isComplete = sqlite3_complete(&zSql[i]);
-      zSql[j+1] = c;
-      if( isComplete ){
-        zSql[j] = 0;
-        while( i<j && ISSPACE(zSql[i]) ){ i++; }
-        if( i<j ){
-          prepareAndRun(pInstVfs, db, &zSql[i]);
-        }
-        zSql[j] = ';';
-        i = j+1;
-      }
-    }
-  }
-  
-  sqlite3_instvfs_destroy(pInstVfs);
-  return 0;
-  
-usage:
-  fprintf(stderr, zUsageMsg, argv[0]);
-  return -3;
-}