/ Check-in [ebb1fd98]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Performance optimization in accessPayload().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ebb1fd98d4e448aa6d8f1e5be7ddc5bedb3db95b
User & Date: drh 2017-01-27 01:13:49
Context
2017-01-27
01:25
Another micro-optimization in accessPayload(). Slightly smaller and faster. check-in: c012619b user: drh tags: trunk
01:13
Performance optimization in accessPayload(). check-in: ebb1fd98 user: drh tags: trunk
00:31
Simplify the accessPayload() routine so that it always populates the overflow page cache. In the one case where populating the page cache can lead to problems, simply invalidate the cache as soon as accessPayload() returns. This simplification reduces code size and helps accessPayload() to run a little faster. This backs out the eOp==2 mode of accessPayload() added by check-in [da59198505]. check-in: 68e7a8c6 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/btree.c.

  4521   4521           }else{
  4522   4522             pCur->nOvflAlloc = nOvfl*2;
  4523   4523             pCur->aOverflow = aNew;
  4524   4524           }
  4525   4525         }
  4526   4526         memset(pCur->aOverflow, 0, nOvfl*sizeof(Pgno));
  4527   4527         pCur->curFlags |= BTCF_ValidOvfl;
  4528         -    }
  4529         -
  4530         -    /* If the overflow page-list cache has been allocated and the
  4531         -    ** entry for the first required overflow page is valid, skip
  4532         -    ** directly to it.
  4533         -    */
  4534         -    if( pCur->aOverflow[offset/ovflSize] ){
  4535         -      iIdx = (offset/ovflSize);
  4536         -      nextPage = pCur->aOverflow[iIdx];
  4537         -      offset = (offset%ovflSize);
         4528  +    }else{
         4529  +      /* If the overflow page-list cache has been allocated and the
         4530  +      ** entry for the first required overflow page is valid, skip
         4531  +      ** directly to it.
         4532  +      */
         4533  +      if( pCur->aOverflow[offset/ovflSize] ){
         4534  +        iIdx = (offset/ovflSize);
         4535  +        nextPage = pCur->aOverflow[iIdx];
         4536  +        offset = (offset%ovflSize);
         4537  +      }
  4538   4538       }
  4539   4539   
  4540   4540       assert( rc==SQLITE_OK && amt>0 );
  4541   4541       while( nextPage ){
  4542   4542         /* If required, populate the overflow page-list cache. */
  4543   4543         assert( pCur->aOverflow[iIdx]==0
  4544   4544                 || pCur->aOverflow[iIdx]==nextPage