]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Speed improvements by removing unnecessary memset() operations.
authordrh <drh@noemail.net>
Fri, 11 Apr 2008 14:56:53 +0000 (14:56 +0000)
committerdrh <drh@noemail.net>
Fri, 11 Apr 2008 14:56:53 +0000 (14:56 +0000)
Also: do not resize the opcode array of a virtual machine to its
minimum size after code generation completes.  The extra resize
merely uses time. (CVS 4987)

FossilOrigin-Name: 2589955507fc1717891c4e07d1d658eb41660b87

manifest
manifest.uuid
src/vdbe.h
src/vdbeaux.c
test/quick.test
tool/lempar.c

index 631fe914afdf33acf5c5a56758ba99d69663ee91..33a3d1a41004618c58fc37308d95c70bbd62c304 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Enhancements\sto\sthe\schange\scounter\stests.\s\sTicket\s#3013.\s(CVS\s4986)
-D 2008-04-10T18:44:36
+C Speed\simprovements\sby\sremoving\sunnecessary\smemset()\soperations.\nAlso:\sdo\snot\sresize\sthe\sopcode\sarray\sof\sa\svirtual\smachine\sto\sits\nminimum\ssize\safter\scode\sgeneration\scompletes.\s\sThe\sextra\sresize\nmerely\suses\stime.\s(CVS\s4987)
+D 2008-04-11T14:56:53
 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
 F Makefile.in b861627d91df5ee422c54237aa38296954dc0151
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -176,10 +176,10 @@ F src/utf.c 8c94fa10efc78c2568d08d436acc59df4df7191b
 F src/util.c 02c57c302ef738ff5b554953c12d8f919e501583
 F src/vacuum.c 3524411bfb58aac0d87eadd3e5b7cd532772af30
 F src/vdbe.c 444ab9ecc91f3c04b2b29ae604458426aa674fa6
-F src/vdbe.h f72201a0657d5f3d6cc008d1f8d9cc65768518c9
+F src/vdbe.h bfd84bda447f39cb599302c7ec85067dae20453c
 F src/vdbeInt.h 0b96efdeecb0803e504bf1c16b198f87c91d6019
 F src/vdbeapi.c ab6e99f8a6b7fcb82c2c698da7a36762a7593f0a
-F src/vdbeaux.c 0aa2d8ede6bdb4379c36491c14d9779221bf196d
+F src/vdbeaux.c 2d17d5bf32e174fb2f9c081e60fd7a7259e90576
 F src/vdbeblob.c cc713c142c3d4952b380c98ee035f850830ddbdb
 F src/vdbefifo.c a30c237b2a3577e1415fb6e288cbb6b8ed1e5736
 F src/vdbemem.c 095e18f84b3171a5f2d71fa93a4bfc64220c1cfe
@@ -414,7 +414,7 @@ F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47
 F test/printf.test c3405535b418d454e8a52196a0fc592ec9eec58d
 F test/progress.test 5b075c3c790c7b2a61419bc199db87aaf48b8301 x
 F test/ptrchng.test 83150cb7b513e33cce90fdc68f4b1817551857c0
-F test/quick.test 3a71af14d9ec0d06e75468de69c71a1a5c059157
+F test/quick.test 33e3eec31d9225e5997fbb27d89fee651bd6ed68
 F test/quote.test 215897dbe8de1a6f701265836d6601cc6ed103e6
 F test/rdonly.test b34db316525440d3b42c32e83942c02c37d28ef0
 F test/reindex.test 38b138abe36bf9a08c791ed44d9f76cd6b97b78b
@@ -549,7 +549,7 @@ F test/zeroblob.test 7d1854ea79d048e023e5f2e38106a7e99a17435c
 F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
 F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439
 F tool/lemon.c 1dc8d53c5ac40f4186ea1bd6ec87a974e18f35a0
-F tool/lempar.c ac41fdc42337c0831fa4c7c848801dccb3fbdd4d
+F tool/lempar.c 5ebb066cdb849a7e0e88206a1b7574cac0f1b063
 F tool/memleak.awk 4e7690a51bf3ed757e611273d43fe3f65b510133
 F tool/memleak2.awk 9cc20c8e8f3c675efac71ea0721ee6874a1566e8
 F tool/memleak3.tcl 7707006ee908cffff210c98158788d85bb3fcdbf
@@ -627,7 +627,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P 0acb1b428d1181f597a2a665cae3eef5775f15f1
-R 0ab9090b08e44f6ff726ed5900963849
+P 1aaed6a4694f60ebcec5dee98f09fe756c81dfa4
+R cd58c5c21bafed0b04ad6e97b420525e
 U drh
-Z 918a38b11853e443c6c24f50c9aec99c
+Z 23e7265ba068d3c833de7bfdbb30c033
index 5ac2862e902e7d082e0af87b594466f2142e7646..1a8210d4ca17733c09d0090165c273541a1e1af9 100644 (file)
@@ -1 +1 @@
-1aaed6a4694f60ebcec5dee98f09fe756c81dfa4
\ No newline at end of file
+2589955507fc1717891c4e07d1d658eb41660b87
\ No newline at end of file
index 5d6bc905add52febd96377532786e63c37c9d66f..5b1a14591599afe57fdc5c3b7a23189a4888d8af 100644 (file)
@@ -15,7 +15,7 @@
 ** or VDBE.  The VDBE implements an abstract machine that runs a
 ** simple program to access and modify the underlying database.
 **
-** $Id: vdbe.h,v 1.129 2008/03/26 18:34:43 danielk1977 Exp $
+** $Id: vdbe.h,v 1.130 2008/04/11 14:56:53 drh Exp $
 */
 #ifndef _SQLITE_VDBE_H_
 #define _SQLITE_VDBE_H_
@@ -44,7 +44,7 @@ typedef struct UnpackedRecord UnpackedRecord;
 struct VdbeOp {
   u8 opcode;          /* What operation to perform */
   signed char p4type; /* One of the P4_xxx constants for p4 */
-  u8 flags;           /* Flags for internal use */
+  u8 opflags;         /* Not currently used */
   u8 p5;              /* Fifth parameter is an unsigned character */
   int p1;             /* First operand */
   int p2;             /* Second parameter (often the jump destination) */
index a6b8ae994daa319a3159d44b050b2366615d44c8..861797fd5cd021f02edf2b9fb390e20cf19f3361 100644 (file)
@@ -113,9 +113,6 @@ static void resizeOpArray(Vdbe *p, int N){
   if( pNew ){
     p->nOpAlloc = N;
     p->aOp = pNew;
-    if( N>oldSize ){
-      memset(&p->aOp[oldSize], 0, (N-oldSize)*sizeof(Op));
-    }
   }
 }
 
@@ -150,6 +147,7 @@ int sqlite3VdbeAddOp3(Vdbe *p, int op, int p1, int p2, int p3){
   p->nOp++;
   pOp = &p->aOp[i];
   pOp->opcode = op;
+  pOp->p5 = 0;
   pOp->p1 = p1;
   pOp->p2 = p2;
   pOp->p3 = p3;
@@ -157,7 +155,12 @@ int sqlite3VdbeAddOp3(Vdbe *p, int op, int p1, int p2, int p3){
   pOp->p4type = P4_NOTUSED;
   p->expired = 0;
 #ifdef SQLITE_DEBUG
+  pOp->zComment = 0;
   if( sqlite3VdbeAddopTrace ) sqlite3VdbePrintOp(0, i, &p->aOp[i]);
+#endif
+#ifdef VDBE_PROFILE
+  pOp->cycles = 0;
+  pOp->cnt = 0;
 #endif
   return i;
 }
@@ -360,6 +363,7 @@ int sqlite3VdbeAddOpList(Vdbe *p, int nOp, VdbeOpList const *aOp){
       pOut->p4.p = 0;
       pOut->p5 = 0;
 #ifdef SQLITE_DEBUG
+      pOut->zComment = 0;
       if( sqlite3VdbeAddopTrace ){
         sqlite3VdbePrintOp(0, i+addr, &p->aOp[i+addr]);
       }
@@ -997,7 +1001,7 @@ void sqlite3VdbeMakeReady(
   if( p->aMem==0 ){
     int nArg;       /* Maximum number of args passed to a user function. */
     resolveP2Values(p, &nArg);
-    resizeOpArray(p, p->nOp);
+    /*resizeOpArray(p, p->nOp);*/
     assert( nVar>=0 );
     if( isExplain && nMem<10 ){
       p->nMem = nMem = 10;
index 26dbf691bfa2ccf220dafee7344e8343ca6b1e44..3a08602a503adc193f75d0a4fbe386cb5cc160cb 100644 (file)
@@ -6,7 +6,7 @@
 #***********************************************************************
 # This file runs all tests.
 #
-# $Id: quick.test,v 1.76 2008/03/31 23:51:35 drh Exp $
+# $Id: quick.test,v 1.77 2008/04/11 14:56:53 drh Exp $
 
 proc lshift {lvar} {
   upvar $lvar l
@@ -69,8 +69,9 @@ set EXCLUDE {
   speed1.test
   speed1p.test
   speed2.test
+  speed3.test
   speed4.test
-  soeed4p.test
+  speed4p.test
   sqllimits1.test
 
   thread001.test
index cca91ad252a0311ec8660a70879e231e0a3a3477..5a7933f41bbd618b654a6ee2316772d34c1f8c13 100644 (file)
 #define YY_ACCEPT_ACTION  (YYNSTATE+YYNRULE+1)
 #define YY_ERROR_ACTION   (YYNSTATE+YYNRULE)
 
+/* The yyzerominor constant is used to initialize instances of
+** YYMINORTYPE objects to zero. */
+static const YYMINORTYPE yyzerominor;
+
 /* Next are that tables used to determine what action to take based on the
 ** current state and lookahead token.  These tables are used to implement
 ** functions that take a state number and lookahead value and return an
@@ -518,7 +522,8 @@ static void yy_reduce(
   ** from wireshark this week.  Clearly they are stressing Lemon in ways
   ** that it has not been previously stressed...  (SQLite ticket #2172)
   */
-  memset(&yygotominor, 0, sizeof(yygotominor));
+  /*memset(&yygotominor, 0, sizeof(yygotominor));*/
+  yygotominor = yyzerominor;
 
 
   switch( yyruleno ){
@@ -649,7 +654,8 @@ void Parse(
   if( yypParser->yyidx<0 ){
 #if YYSTACKDEPTH<=0
     if( yypParser->yystksz <=0 ){
-      memset(&yyminorunion, 0, sizeof(yyminorunion));
+      /*memset(&yyminorunion, 0, sizeof(yyminorunion));*/
+      yyminorunion = yyzerominor;
       yyStackOverflow(yypParser, &yyminorunion);
       return;
     }