/ Check-in [984a96d7]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Remove the peep-hole optimization of removing OP_Close opcodes that come before OP_Halt, as the extra work of removing those opcodes uses more cycles than just running them.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 984a96d79656c1b095aba1f88aca4bb787ba0bd8
User & Date: drh 2016-09-29 19:50:02
Context
2016-09-29
20:28
Small size and performance optimization to sqlite3VdbeChangeP5(). check-in: 3c93c8f5 user: drh tags: trunk
19:50
Remove the peep-hole optimization of removing OP_Close opcodes that come before OP_Halt, as the extra work of removing those opcodes uses more cycles than just running them. check-in: 984a96d7 user: drh tags: trunk
19:27
Size and performance optimization to sqlite3ValueFromExpr() check-in: 945f82bc user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/build.c.

   142    142     /* Begin by generating some termination code at the end of the
   143    143     ** vdbe program
   144    144     */
   145    145     v = sqlite3GetVdbe(pParse);
   146    146     assert( !pParse->isMultiWrite 
   147    147          || sqlite3VdbeAssertMayAbort(v, pParse->mayAbort));
   148    148     if( v ){
   149         -    while( sqlite3VdbeDeletePriorOpcode(v, OP_Close) ){}
   150    149       sqlite3VdbeAddOp0(v, OP_Halt);
   151    150   
   152    151   #if SQLITE_USER_AUTHENTICATION
   153    152       if( pParse->nTableLock>0 && db->init.busy==0 ){
   154    153         sqlite3UserAuthInit(db);
   155    154         if( db->auth.authLevel<UAUTH_User ){
   156    155           sqlite3ErrorMsg(pParse, "user not authenticated");

Changes to src/sqliteInt.h.

  2895   2895     int iRangeReg;       /* First register in temporary register block */
  2896   2896     int nErr;            /* Number of errors seen */
  2897   2897     int nTab;            /* Number of previously allocated VDBE cursors */
  2898   2898     int nMem;            /* Number of memory cells used so far */
  2899   2899     int nSet;            /* Number of sets used so far */
  2900   2900     int nOpAlloc;        /* Number of slots allocated for Vdbe.aOp[] */
  2901   2901     int szOpAlloc;       /* Bytes of memory space allocated for Vdbe.aOp[] */
  2902         -  int iFixedOp;        /* Never back out opcodes iFixedOp-1 or earlier */
  2903   2902     int ckBase;          /* Base register of data during check constraints */
  2904   2903     int iSelfTab;        /* Table of an index whose exprs are being coded */
  2905   2904     int iCacheLevel;     /* ColCache valid when aColCache[].iLevel<=iCacheLevel */
  2906   2905     int iCacheCnt;       /* Counter used to generate aColCache[].lru values */
  2907   2906     int nLabel;          /* Number of labels used */
  2908   2907     int *aLabel;         /* Space to hold the labels */
  2909   2908     struct yColCache {

Changes to src/vdbeaux.c.

   370    370     int j = ADDR(x);
   371    371     assert( v->magic==VDBE_MAGIC_INIT );
   372    372     assert( j<p->nLabel );
   373    373     assert( j>=0 );
   374    374     if( p->aLabel ){
   375    375       p->aLabel[j] = v->nOp;
   376    376     }
   377         -  p->iFixedOp = v->nOp - 1;
   378    377   }
   379    378   
   380    379   /*
   381    380   ** Mark the VDBE as one that can only be run one time.
   382    381   */
   383    382   void sqlite3VdbeRunOnlyOnce(Vdbe *p){
   384    383     p->runOnlyOnce = 1;
................................................................................
   769    768   }
   770    769   
   771    770   /*
   772    771   ** Change the P2 operand of instruction addr so that it points to
   773    772   ** the address of the next instruction to be coded.
   774    773   */
   775    774   void sqlite3VdbeJumpHere(Vdbe *p, int addr){
   776         -  p->pParse->iFixedOp = p->nOp - 1;
   777    775     sqlite3VdbeChangeP2(p, addr, p->nOp);
   778    776   }
   779    777   
   780    778   
   781    779   /*
   782    780   ** If the input FuncDef structure is ephemeral, then free it.  If
   783    781   ** the FuncDef is not ephermal, then do nothing.
................................................................................
   892    890   }
   893    891   
   894    892   /*
   895    893   ** If the last opcode is "op" and it is not a jump destination,
   896    894   ** then remove it.  Return true if and only if an opcode was removed.
   897    895   */
   898    896   int sqlite3VdbeDeletePriorOpcode(Vdbe *p, u8 op){
   899         -  if( (p->nOp-1)>(p->pParse->iFixedOp) && p->aOp[p->nOp-1].opcode==op ){
          897  +  if( p->nOp>0 && p->aOp[p->nOp-1].opcode==op ){
   900    898       return sqlite3VdbeChangeToNoop(p, p->nOp-1);
   901    899     }else{
   902    900       return 0;
   903    901     }
   904    902   }
   905    903   
   906    904   /*