/ Check-in [f8d5efcd]
Login

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

Overview
Comment:Unpack some fields, adding some space back to the VdbeCursor object, in order to help the code to run a little faster.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | OP_Column-refactor
Files: files | file ages | folders
SHA1:f8d5efcd7b92492b833b6cd1cb6bec006c6a0809
User & Date: drh 2013-11-21 00:10:35
Context
2013-11-21
01:04
Reduce the size of VdbeCursor again, this time without a performance hit. Closed-Leaf check-in: 93393993 user: drh tags: OP_Column-refactor
00:10
Unpack some fields, adding some space back to the VdbeCursor object, in order to help the code to run a little faster. check-in: f8d5efcd user: drh tags: OP_Column-refactor
2013-11-20
21:51
Reduce the size of the VdbeCursor object from 144 to 120 bytes. check-in: 5f9d5068 user: drh tags: OP_Column-refactor
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

  3755   3755     rc = sqlite3BtreeMovetoUnpacked(pC->pCursor, pIdxKey, 0, 0, &res);
  3756   3756     if( pOp->p4.i==0 ){
  3757   3757       sqlite3DbFree(db, pFree);
  3758   3758     }
  3759   3759     if( rc!=SQLITE_OK ){
  3760   3760       break;
  3761   3761     }
  3762         -  pC->seekResult = res==0 ? 0 : res<0 ? -1 : +1;
         3762  +  pC->seekResult = res;
  3763   3763     alreadyExists = (res==0);
  3764   3764     pC->nullRow = 1-alreadyExists;
  3765   3765     pC->deferredMoveto = 0;
  3766   3766     pC->cacheStatus = CACHE_STALE;
  3767   3767     if( pOp->opcode==OP_Found ){
  3768   3768       if( alreadyExists ) pc = pOp->p2 - 1;
  3769   3769     }else{
................................................................................
  3809   3809     pC->nullRow = 0;
  3810   3810     pC->cacheStatus = CACHE_STALE;
  3811   3811     pC->deferredMoveto = 0;
  3812   3812     if( res!=0 ){
  3813   3813       pc = pOp->p2 - 1;
  3814   3814       assert( pC->rowidIsValid==0 );
  3815   3815     }
  3816         -  pC->seekResult = res==0 ? 0 : res<0 ? -1 : +1;
         3816  +  pC->seekResult = res;
  3817   3817     break;
  3818   3818   }
  3819   3819   
  3820   3820   /* Opcode: Sequence P1 P2 * * *
  3821   3821   ** Synopsis: r[P2]=rowid
  3822   3822   **
  3823   3823   ** Find the next available sequence number for cursor P1.
................................................................................
  4032   4032   case OP_Insert: 
  4033   4033   case OP_InsertInt: {
  4034   4034     Mem *pData;       /* MEM cell holding data for the record to be inserted */
  4035   4035     Mem *pKey;        /* MEM cell holding key  for the record */
  4036   4036     i64 iKey;         /* The integer ROWID or key for the record to be inserted */
  4037   4037     VdbeCursor *pC;   /* Cursor to table into which insert is written */
  4038   4038     int nZero;        /* Number of zero-bytes to append */
  4039         -  i8 seekResult;    /* Result of prior seek or 0 if no USESEEKRESULT flag */
         4039  +  int seekResult;   /* Result of prior seek or 0 if no USESEEKRESULT flag */
  4040   4040     const char *zDb;  /* database name - used by the update hook */
  4041   4041     const char *zTbl; /* Table name - used by the opdate hook */
  4042   4042     int op;           /* Opcode for update hook: SQLITE_UPDATE or SQLITE_INSERT */
  4043   4043   
  4044   4044     pData = &aMem[pOp->p2];
  4045   4045     assert( pOp->p1>=0 && pOp->p1<p->nCursor );
  4046   4046     assert( memIsValid(pData) );

Changes to src/vdbeInt.h.

    57     57   ** Every cursor that the virtual machine has open is represented by an
    58     58   ** instance of the following structure.
    59     59   */
    60     60   struct VdbeCursor {
    61     61     BtCursor *pCursor;    /* The cursor structure of the backend */
    62     62     Btree *pBt;           /* Separate file holding temporary table */
    63     63     KeyInfo *pKeyInfo;    /* Info about index keys needed by index cursors */
           64  +  int seekResult;       /* Result of previous sqlite3BtreeMoveto() */
    64     65     int pseudoTableReg;   /* Register holding pseudotable content. */
    65     66     i16 nField;           /* Number of fields in the header */
    66     67     u16 nHdrParsed;       /* Number of header fields parsed so far */
    67     68     i8 iDb;               /* Index of cursor database in db->aDb[] (or -1) */
    68         -  i8 seekResult;        /* Result of previous sqlite3BtreeMoveto() */
    69         -  Bool nullRow:1;       /* True if pointing to a row with no data */
    70         -  Bool rowidIsValid :1; /* True if lastRowid is valid */
           69  +  u8 nullRow;           /* True if pointing to a row with no data */
           70  +  u8 rowidIsValid;      /* True if lastRowid is valid */
           71  +  u8 deferredMoveto;    /* A call to sqlite3BtreeMoveto() is needed */
    71     72     Bool useRandomRowid:1;/* Generate new record numbers semi-randomly */
    72         -  Bool deferredMoveto:1;/* A call to sqlite3BtreeMoveto() is needed */
    73     73     Bool isTable:1;       /* True if a table requiring integer keys */
    74     74     Bool isOrdered:1;     /* True if the underlying table is BTREE_UNORDERED */
    75     75     Bool multiPseudo:1;   /* Multi-register pseudo-cursor */
    76     76     sqlite3_vtab_cursor *pVtabCursor;  /* The cursor for a virtual table */
    77     77     const sqlite3_module *pModule;     /* Module for cursor pVtabCursor */
    78     78     i64 seqCount;         /* Sequence counter */
    79     79     i64 movetoTarget;     /* Argument to the deferred sqlite3BtreeMoveto() */