/ Check-in [86839476]
Login

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

Overview
Comment:Minor changes to the core of OP_Column for performance and to clarify the critical path.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | faster-typeof-and-length
Files: files | file ages | folders
SHA1:868394761e41b7483a5874426ee052dfb3a9e2be
User & Date: drh 2012-03-28 16:14:50
Context
2012-03-28
16:22
Avoid loading overflow pages just to satisfy typeof() or length() functions if the correct result can be computed without the extra page fetches. check-in: 0733c98c user: drh tags: trunk
16:14
Minor changes to the core of OP_Column for performance and to clarify the critical path. Closed-Leaf check-in: 86839476 user: drh tags: faster-typeof-and-length
13:41
Improvements to comments. Minor changes to code in the hot path of OP_Column - with the hope of get a few cycles of performance improvement. check-in: ca093103 user: drh tags: faster-typeof-and-length
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

  2377   2377     ** then there are not enough fields in the record to satisfy the
  2378   2378     ** request.  In this case, set the value NULL or to P4 if P4 is
  2379   2379     ** a pointer to a Mem object.
  2380   2380     */
  2381   2381     if( aOffset[p2] ){
  2382   2382       assert( rc==SQLITE_OK );
  2383   2383       if( zRec ){
         2384  +      /* This is the common case where the whole row fits on a single page */
  2384   2385         VdbeMemRelease(pDest);
  2385   2386         sqlite3VdbeSerialGet((u8 *)&zRec[aOffset[p2]], aType[p2], pDest);
  2386   2387       }else{
         2388  +      /* This branch happens only when the row overflows onto multiple pages */
  2387   2389         t = aType[p2];
  2388         -      len = sqlite3VdbeSerialTypeLen(t);
  2389   2390         if( (pOp->p5 & (OPFLAG_LENGTHARG|OPFLAG_TYPEOFARG))!=0
  2390   2391          && ((t>=12 && (t&1)==0) || (pOp->p5 & OPFLAG_TYPEOFARG)!=0)
  2391   2392         ){
  2392   2393           /* Content is irrelevant for the typeof() function and for
  2393   2394           ** the length(X) function if X is a blob.  So we might as well use
  2394   2395           ** bogus content rather than reading content from disk.  NULL works
  2395   2396           ** for text and blob and whatever is in the payloadSize64 variable
  2396   2397           ** will work for everything else. */
  2397   2398           zData = t<12 ? (char*)&payloadSize64 : 0;
  2398   2399         }else{
         2400  +        len = sqlite3VdbeSerialTypeLen(t);
  2399   2401           sqlite3VdbeMemMove(&sMem, pDest);
  2400   2402           rc = sqlite3VdbeMemFromBtree(pCrsr, aOffset[p2], len,  pC->isIndex,
  2401   2403                                        &sMem);
  2402   2404           if( rc!=SQLITE_OK ){
  2403   2405             goto op_column_out;
  2404   2406           }
  2405   2407           zData = sMem.z;