/ Check-in [b6b73a74]
Login

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

Overview
Comment:Small performance improvement to OP_Column.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | experimental
Files: files | file ages | folders
SHA1:b6b73a747ad8d0f026074e41c2a4adc529ec2674
User & Date: drh 2011-08-29 02:16:18
Context
2011-08-29
02:49
About a 1% overall performance improvement by using a macro to avoid no-op calls to sqlite3MemReleaseExternal(). Closed-Leaf check-in: ff71d20a user: drh tags: experimental
02:16
Small performance improvement to OP_Column. check-in: b6b73a74 user: drh tags: experimental
2011-08-28
02:15
About a 3% improvement in the performance of OP_Column. check-in: edff9d4a user: drh tags: experimental
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

  2114   2114     Mem sMem;          /* For storing the record being decoded */
  2115   2115     u8 *zIdx;          /* Index into header */
  2116   2116     u8 *zEndHdr;       /* Pointer to first byte after the header */
  2117   2117     u32 offset;        /* Offset into the data */
  2118   2118     u32 szField;       /* Number of bytes in the content of a field */
  2119   2119     int szHdr;         /* Size of the header size field at start of record */
  2120   2120     int avail;         /* Number of bytes of available data */
         2121  +  u32 t;             /* A type code from the record header */
  2121   2122     Mem *pReg;         /* PseudoTable input register */
  2122   2123   
  2123   2124   
  2124   2125     p1 = pOp->p1;
  2125   2126     p2 = pOp->p2;
  2126   2127     pC = 0;
  2127   2128     memset(&sMem, 0, sizeof(sMem));
................................................................................
  2291   2292       ** arrays.  aType[i] will contain the type integer for the i-th
  2292   2293       ** column and aOffset[i] will contain the offset from the beginning
  2293   2294       ** of the record to the start of the data for the i-th column
  2294   2295       */
  2295   2296       for(i=0; i<nField; i++){
  2296   2297         if( zIdx<zEndHdr ){
  2297   2298           aOffset[i] = offset;
  2298         -        zIdx += getVarint32(zIdx, aType[i]);
  2299         -        szField = sqlite3VdbeSerialTypeLen(aType[i]);
         2299  +        if( zIdx[0]<0x80 ){
         2300  +          t = zIdx[0];
         2301  +          zIdx++;
         2302  +        }else{
         2303  +          zIdx += sqlite3GetVarint32(zIdx, &t);
         2304  +        }
         2305  +        aType[i] = t;
         2306  +        szField = sqlite3VdbeSerialTypeLen(t);
  2300   2307           offset += szField;
  2301   2308           if( offset<szField ){  /* True if offset overflows */
  2302   2309             zIdx = &zEndHdr[1];  /* Forces SQLITE_CORRUPT return below */
  2303   2310             break;
  2304   2311           }
  2305   2312         }else{
  2306   2313           /* If i is less that nField, then there are less fields in this