]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Update the wordcount.c test program and add a new script "time-wordcount.sh"
authordrh <drh@noemail.net>
Mon, 1 Aug 2016 21:17:53 +0000 (21:17 +0000)
committerdrh <drh@noemail.net>
Mon, 1 Aug 2016 21:17:53 +0000 (21:17 +0000)
for additional performance testing.

FossilOrigin-Name: d8ef9f58643f13dd3d16dcde0d829ae08324f04b

manifest
manifest.uuid
test/time-wordcount.sh [new file with mode: 0644]
test/wordcount.c

index fc5ee826f45a33bf6ecc1ec6abe430822b760c65..15cc8e13819df42c22a0488cf36b84c40ef5802a 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sother\sharmless\scompiler\swarnings.
-D 2016-08-01T17:06:44.553
+C Update\sthe\swordcount.c\stest\sprogram\sand\sadd\sa\snew\sscript\s"time-wordcount.sh"\nfor\sadditional\sperformance\stesting.
+D 2016-08-01T21:17:53.023
 F Makefile.in 6c20d44f72d4564f11652b26291a214c8367e5db
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 3340e479e5221f06c3d61726f8f7efff885e4233
@@ -1142,6 +1142,7 @@ F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b
 F test/threadtest2.c a70a8e94bef23339d34226eb9521015ef99f4df8
 F test/threadtest3.c 38a612ea62854349ed66372f330a40d73c5cf956
 F test/threadtest4.c c1e67136ceb6c7ec8184e56ac61db28f96bd2925
+F test/time-wordcount.sh 8e0b0f8109367827ad5d58f5cc849705731e4b90
 F test/tkt-02a8e81d44.test 6c80d9c7514e2a42d4918bf87bf6bc54f379110c
 F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660
 F test/tkt-2a5629202f.test 0521bd25658428baa26665aa53ffed9367d33af2
@@ -1416,7 +1417,7 @@ F test/without_rowid3.test aad4f9d383e199349b6c7e508a778f7dff5dff79
 F test/without_rowid4.test 4e08bcbaee0399f35d58b5581881e7a6243d458a
 F test/without_rowid5.test 89b1c587bd92a0590e440da33e7666bf4891572a
 F test/without_rowid6.test 1f99644e6508447fb050f73697350c7ceca3392e
-F test/wordcount.c 2a0a6c0d0e8e8bbbac1f06d72a6791828c37c0cf
+F test/wordcount.c 97856eec21fd00d77da720007b1888c383f63dcf
 F test/zeroblob.test 3857870fe681b8185654414a9bccfde80b62a0fa
 F test/zerodamage.test e59a56443d6298ecf7435f618f0b27654f0c849e
 F tool/GetFile.cs a15e08acb5dd7539b75ba23501581d7c2b462cb5
@@ -1508,7 +1509,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P fd184e5a8f4577aa9a817eb55e771d8d1021b946
-R ee6ea998e955e1020bf52b2850224f49
+P 90d2c490fc2ed4e073711b84f989ca4d496dcfb5
+R 785c152fa91bad6599d646e4e2f00927
 U drh
-Z 082f7342c6c06c2add554ab4b05f638a
+Z e82d6de7fe92cf55ce862dce0d383efb
index 0a3df4be929fbbb34cd4d4bdb0dd4c34755bf063..a4b3d0224f6c2a8c346917302abaf58c9fb34db3 100644 (file)
@@ -1 +1 @@
-90d2c490fc2ed4e073711b84f989ca4d496dcfb5
\ No newline at end of file
+d8ef9f58643f13dd3d16dcde0d829ae08324f04b
\ No newline at end of file
diff --git a/test/time-wordcount.sh b/test/time-wordcount.sh
new file mode 100644 (file)
index 0000000..df9edc6
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# This script runs the wordcount program in different ways and generates
+# an output useful for performance comparisons.
+#
+
+# Select the source text to be analyzed.
+#
+if test "x$1" = "x";
+then echo "Usage: $0 FILENAME [ARGS...]"; exit 1;
+fi
+
+# Do test runs
+#
+rm -f wcdb1.db
+./wordcount --tag A: --timer --summary wcdb1.db $* --insert
+rm -f wcdb2.db
+./wordcount --tag B: --timer --summary wcdb2.db $* --insert --without-rowid
+rm -f wcdb1.db
+./wordcount --tag C: --timer --summary wcdb1.db $* --replace
+rm -f wcdb2.db
+./wordcount --tag D: --timer --summary wcdb2.db $* --replace --without-rowid
+rm -f wcdb1.db
+./wordcount --tag E: --timer --summary wcdb1.db $* --select
+rm -f wcdb2.db
+./wordcount --tag F: --timer --summary wcdb2.db $* --select --without-rowid
+./wordcount --tag G: --timer --summary wcdb1.db $* --query
+./wordcount --tag H: --timer --summary wcdb1.db $* --query --without-rowid
+./wordcount --tag I: --timer --summary wcdb1.db $* --delete
+./wordcount --tag J: --timer --summary wcdb2.db $* --delete --without-rowid
+
+# Clean up temporary files created.
+#
+rm -f wcdb1.db wcdb2.db
index 72aa6b2f0b0ad26809abc58effc28814a01e215f..5002918c5e6889518574a9d5aa6119abf27dae27 100644 (file)
@@ -30,6 +30,7 @@
 **     --nosync             Use PRAGMA synchronous=OFF
 **     --journal MMMM       Use PRAGMA journal_mode=MMMM
 **     --timer              Time the operation of this program
+**     --tag NAME           Tag all output using NAME.  Use only stdout.
 **
 ** Modes:
 **
@@ -82,6 +83,9 @@
 #include "sqlite3.h"
 #define ISALPHA(X) isalpha((unsigned char)(X))
 
+/* Output tag */
+char *zTag = "--";
+
 /* Return the current wall-clock time */
 static sqlite3_int64 realTime(void){
   static sqlite3_vfs *clockVfs = 0;
@@ -115,7 +119,7 @@ static void traceCallback(void *NotUsed, const char *zSql){
 ** each column separated by a single space. */
 static int printResult(void *NotUsed, int nArg, char **azArg, char **azNm){
   int i;
-  printf("--");
+  printf("%s", zTag);
   for(i=0; i<nArg; i++){
     printf(" %s", azArg[i] ? azArg[i] : "(null)");
   }
@@ -220,6 +224,7 @@ int main(int argc, char **argv){
   FILE *in;                     /* The open input file */
   int rc;                       /* Return code from an SQLite interface */
   int iCur, iHiwtr;             /* Statistics values, current and "highwater" */
+  FILE *pTimer = stderr;        /* Output channel for the timer */
   sqlite3_int64 sumCnt = 0;     /* Sum in QUERY mode */
   sqlite3_int64 startTime;
   char zInput[2000];            /* A single line of input */
@@ -266,6 +271,9 @@ int main(int argc, char **argv){
         commitInterval = atoi(argv[i]);
       }else if( strcmp(z,"journal")==0 && i<argc-1 ){
         zJMode = argv[++i];
+      }else if( strcmp(z,"tag")==0 && i<argc-1 ){
+        zTag = argv[++i];
+        pTimer = stdout;
       }else{
         fatal_error("unknown option: %s\n", argv[i]);
       }
@@ -462,11 +470,11 @@ int main(int argc, char **argv){
   sqlite3_finalize(pDelete);
 
   if( iMode==MODE_QUERY ){
-    printf("sum of cnt: %lld\n", sumCnt);
+    printf("%s sum of cnt: %lld\n", zTag, sumCnt);
     rc = sqlite3_prepare_v2(db,"SELECT sum(cnt*cnt) FROM wordcount", -1,
                             &pSelect, 0);
     if( rc==SQLITE_OK && sqlite3_step(pSelect)==SQLITE_ROW ){
-      printf("double-check: %lld\n", sqlite3_column_int64(pSelect, 0));
+      printf("%s double-check: %lld\n", zTag, sqlite3_column_int64(pSelect, 0));
     }
     sqlite3_finalize(pSelect);
   }
@@ -474,10 +482,10 @@ int main(int argc, char **argv){
 
   if( showTimer ){
     sqlite3_int64 elapseTime = realTime() - startTime;
-    fprintf(stderr, "%3d.%03d wordcount", (int)(elapseTime/1000),
+    fprintf(pTimer, "%3d.%03d wordcount", (int)(elapseTime/1000),
                                    (int)(elapseTime%1000));
-    for(i=1; i<argc; i++) if( i!=showTimer ) fprintf(stderr, " %s", argv[i]);
-    fprintf(stderr, "\n");
+    for(i=1; i<argc; i++) if( i!=showTimer ) fprintf(pTimer, " %s", argv[i]);
+    fprintf(pTimer, "\n");
   }
 
   if( showSummary ){
@@ -501,25 +509,25 @@ int main(int argc, char **argv){
   ** have been finalized */
   if( showStats ){
     sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_USED, &iCur, &iHiwtr, 0);
-    printf("-- Lookaside Slots Used:        %d (max %d)\n", iCur,iHiwtr);
+    printf("%s Lookaside Slots Used:        %d (max %d)\n", zTag, iCur,iHiwtr);
     sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_HIT, &iCur, &iHiwtr, 0);
-    printf("-- Successful lookasides:       %d\n", iHiwtr);
+    printf("%s Successful lookasides:       %d\n", zTag, iHiwtr);
     sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE, &iCur,&iHiwtr,0);
-    printf("-- Lookaside size faults:       %d\n", iHiwtr);
+    printf("%s Lookaside size faults:       %d\n", zTag, iHiwtr);
     sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL, &iCur,&iHiwtr,0);
-    printf("-- Lookaside OOM faults:        %d\n", iHiwtr);
+    printf("%s Lookaside OOM faults:        %d\n", zTag, iHiwtr);
     sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_USED, &iCur, &iHiwtr, 0);
-    printf("-- Pager Heap Usage:            %d bytes\n", iCur);
+    printf("%s Pager Heap Usage:            %d bytes\n", zTag, iCur);
     sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_HIT, &iCur, &iHiwtr, 1);
-    printf("-- Page cache hits:             %d\n", iCur);
+    printf("%s Page cache hits:             %d\n", zTag, iCur);
     sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_MISS, &iCur, &iHiwtr, 1);
-    printf("-- Page cache misses:           %d\n", iCur); 
+    printf("%s Page cache misses:           %d\n", zTag, iCur); 
     sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_WRITE, &iCur, &iHiwtr, 1);
-    printf("-- Page cache writes:           %d\n", iCur); 
+    printf("%s Page cache writes:           %d\n", zTag, iCur); 
     sqlite3_db_status(db, SQLITE_DBSTATUS_SCHEMA_USED, &iCur, &iHiwtr, 0);
-    printf("-- Schema Heap Usage:           %d bytes\n", iCur); 
+    printf("%s Schema Heap Usage:           %d bytes\n", zTag, iCur); 
     sqlite3_db_status(db, SQLITE_DBSTATUS_STMT_USED, &iCur, &iHiwtr, 0);
-    printf("-- Statement Heap Usage:        %d bytes\n", iCur); 
+    printf("%s Statement Heap Usage:        %d bytes\n", zTag, iCur); 
   }
 
   sqlite3_close(db);
@@ -528,19 +536,19 @@ int main(int argc, char **argv){
   ** has closed.  Memory usage should be zero at this point. */
   if( showStats ){
     sqlite3_status(SQLITE_STATUS_MEMORY_USED, &iCur, &iHiwtr, 0);
-    printf("-- Memory Used (bytes):         %d (max %d)\n", iCur,iHiwtr);
+    printf("%s Memory Used (bytes):         %d (max %d)\n", zTag,iCur,iHiwtr);
     sqlite3_status(SQLITE_STATUS_MALLOC_COUNT, &iCur, &iHiwtr, 0);
-    printf("-- Outstanding Allocations:     %d (max %d)\n", iCur,iHiwtr);
+    printf("%s Outstanding Allocations:     %d (max %d)\n",zTag,iCur,iHiwtr);
     sqlite3_status(SQLITE_STATUS_PAGECACHE_OVERFLOW, &iCur, &iHiwtr, 0);
-    printf("-- Pcache Overflow Bytes:       %d (max %d)\n", iCur,iHiwtr);
+    printf("%s Pcache Overflow Bytes:       %d (max %d)\n",zTag,iCur,iHiwtr);
     sqlite3_status(SQLITE_STATUS_SCRATCH_OVERFLOW, &iCur, &iHiwtr, 0);
-    printf("-- Scratch Overflow Bytes:      %d (max %d)\n", iCur,iHiwtr);
+    printf("%s Scratch Overflow Bytes:      %d (max %d)\n",zTag,iCur,iHiwtr);
     sqlite3_status(SQLITE_STATUS_MALLOC_SIZE, &iCur, &iHiwtr, 0);
-    printf("-- Largest Allocation:          %d bytes\n",iHiwtr);
+    printf("%s Largest Allocation:          %d bytes\n",zTag,iHiwtr);
     sqlite3_status(SQLITE_STATUS_PAGECACHE_SIZE, &iCur, &iHiwtr, 0);
-    printf("-- Largest Pcache Allocation:   %d bytes\n",iHiwtr);
+    printf("%s Largest Pcache Allocation:   %d bytes\n",zTag,iHiwtr);
     sqlite3_status(SQLITE_STATUS_SCRATCH_SIZE, &iCur, &iHiwtr, 0);
-    printf("-- Largest Scratch Allocation:  %d bytes\n", iHiwtr);
+    printf("%s Largest Scratch Allocation:  %d bytes\n",zTag,iHiwtr);
   }
   return 0;
 }