]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Changes speedtest8 and speedtest16 so that the database file can be specified
authordrh <drh@noemail.net>
Thu, 3 Apr 2008 17:57:24 +0000 (17:57 +0000)
committerdrh <drh@noemail.net>
Thu, 3 Apr 2008 17:57:24 +0000 (17:57 +0000)
on the command-line.  Allows speed testing against a :memory: database. (CVS 4960)

FossilOrigin-Name: 64badc50531668de45d76a3dcd90db17e1fe1ab1

manifest
manifest.uuid
tool/speedtest16.c
tool/speedtest8.c

index 1af5369640ff4d0c5be5968d639d65a88324e84c..e86e8ccb828a1171d19f11d59a3355c031961416 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Instead\sof\scalling\ssqlite3_exec()\sto\sevaluate\s"PRAGMA\sencoding\s=\sUTF16"\sin\ssqlite3_open16(),\sset\sthe\sconnection\sencoding\sflag\sdirectly.\s(CVS\s4959)
-D 2008-04-03T16:28:25
+C Changes\sspeedtest8\sand\sspeedtest16\sso\sthat\sthe\sdatabase\sfile\scan\sbe\sspecified\non\sthe\scommand-line.\s\sAllows\sspeed\stesting\sagainst\sa\s:memory:\sdatabase.\s(CVS\s4960)
+D 2008-04-03T17:57:25
 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
 F Makefile.in b861627d91df5ee422c54237aa38296954dc0151
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -564,9 +564,9 @@ F tool/soak1.tcl 85a4a7826c77351bfe1c005ae3cff2ef59123557
 F tool/space_used.tcl f714c41a59e326b8b9042f415b628b561bafa06b
 F tool/spaceanal.tcl b87db46ae29e3116411b1686e136b9b994d7de39
 F tool/speedtest.tcl 06c76698485ccf597b9e7dbb1ac70706eb873355
-F tool/speedtest16.c 130615cf89ad76fa87fcf16a2205ce53510fc330
+F tool/speedtest16.c 6e0f8c2f8826989ac351a0f269d36b0eaea221d7
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
-F tool/speedtest8.c bbe608e9ac57f64fd324ecb23de54ab17cd86dba
+F tool/speedtest8.c 9a614005cf2cad4fe922952db3fdeaccd2c09c3a
 F www/34to35.tcl 942e479aa7740b55d714dce0f0b2cb6ca91c3f20
 F www/arch.fig d5f9752a4dbf242e9cfffffd3f5762b6c63b3bcf
 F www/arch.gif f845a64772062e82d17980a349f95f1f0b4c8054
@@ -625,7 +625,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P b8d211a76fa56d812fc1758b58d65eef832494cb
-R 8c44dce20057b42a443a4b9f7f4dfd9c
-U danielk1977
-Z 259f442ab55cd26c4a285d05c392d693
+P 33a12e737c343dbc452a25321a63456c1a8f7548
+R 1b9d6571f04e3f2e90317d2d7e6f6132
+U drh
+Z ad27df22dc86b86d653d16cbbba127a5
index e7fd2808f51f87107d76c6738c4b4b9e24e650ec..ebf27df48e953401e80bedebcde3e4b3065bf1b2 100644 (file)
@@ -1 +1 @@
-33a12e737c343dbc452a25321a63456c1a8f7548
\ No newline at end of file
+64badc50531668de45d76a3dcd90db17e1fe1ab1
\ No newline at end of file
index a8401adbff183962a57834a60295b5f1a7329273..343e0348be6825aa08da302ba857412915b7da93 100644 (file)
@@ -20,7 +20,7 @@
 ** 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.sql
+**     ./a.out database.db test.sql
 */
 #include <stdio.h>
 #include <string.h>
@@ -112,14 +112,16 @@ int main(int argc, char **argv){
   FILE *in;
   unsigned long long int iStart, iElapse;
   unsigned long long int iSetup = 0;
+  int nStmt = 0;
+  int nByte = 0;
 
-  if( argc!=2 ){
-    fprintf(stderr, "Usage: %s SQL-SCRIPT\n"
+  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[1], "r");
+  in = fopen(argv[2], "r");
   fseek(in, 0L, SEEK_END);
   nSql = ftell(in);
   zSql = malloc( nSql+1 );
@@ -128,9 +130,8 @@ int main(int argc, char **argv){
   zSql[nSql] = 0;
 
   printf("SQLite version: %d\n", sqlite3_libversion_number());
-  unlink("test.db");
-  unlink("test.db-journal");
-  utf16 = asciiToUtf16le("test.db");
+  unlink(argv[1]);
+  utf16 = asciiToUtf16le(argv[1]);
   iStart = hwtime();
   rc = sqlite3_open16(utf16, &db);
   iElapse = hwtime() - iStart;
@@ -148,6 +149,8 @@ int main(int argc, char **argv){
         zSql[j] = 0;
         while( i<j && isspace(zSql[i]) ){ i++; }
         if( i<j ){
+          nStmt++;
+          nByte += j-i;
           prepareAndRun(db, &zSql[i]);
         }
         zSql[j] = ';';
@@ -161,6 +164,8 @@ int main(int argc, char **argv){
   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);
index 11ba9cf59a315a50ca632b610bb2224096fe50cd..ad97626a43f48e464c2ff03bd3c01ea99c66b454 100644 (file)
@@ -19,7 +19,7 @@
 ** 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.sql
+**     ./a.out test.db  test.sql
 */
 #include <stdio.h>
 #include <string.h>
@@ -89,14 +89,16 @@ int main(int argc, char **argv){
   FILE *in;
   unsigned long long int iStart, iElapse;
   unsigned long long int iSetup = 0;
+  int nStmt = 0;
+  int nByte = 0;
 
-  if( argc!=2 ){
-    fprintf(stderr, "Usage: %s SQL-SCRIPT\n"
+  if( argc!=3 ){
+    fprintf(stderr, "Usage: %s FILENAME SQL-SCRIPT\n"
                     "Runs SQL-SCRIPT against a UTF8 database\n",
                     argv[0]);
     exit(1);
   }
-  in = fopen(argv[1], "r");
+  in = fopen(argv[2], "r");
   fseek(in, 0L, SEEK_END);
   nSql = ftell(in);
   zSql = malloc( nSql+1 );
@@ -105,10 +107,9 @@ int main(int argc, char **argv){
   zSql[nSql] = 0;
 
   printf("SQLite version: %d\n", sqlite3_libversion_number());
-  unlink("test.db");
-  unlink("test.db-journal");
+  unlink(argv[1]);
   iStart = hwtime();
-  rc = sqlite3_open("test.db", &db);
+  rc = sqlite3_open(argv[1], &db);
   iElapse = hwtime() - iStart;
   iSetup = iElapse;
   printf("sqlite3_open() returns %d in %llu cycles\n", rc, iElapse);
@@ -123,6 +124,8 @@ int main(int argc, char **argv){
         zSql[j] = 0;
         while( i<j && isspace(zSql[i]) ){ i++; }
         if( i<j ){
+          nStmt++;
+          nByte += j-i;
           prepareAndRun(db, &zSql[i]);
         }
         zSql[j] = ';';
@@ -136,6 +139,8 @@ int main(int argc, char **argv){
   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);