/ Check-in [63962e2a]
Login

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

Overview
Comment:Small performance optimization in the freeSpace() routine of btree.c.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 63962e2a927963575be74c3ce11f39f722c07c72
User & Date: drh 2016-09-17 19:34:32
Context
2016-09-17
22:46
Minor enhancement to the TclKit batch tool: it should download the TclKit EXE alone when the TCLKIT_NOENV environment variable is set. check-in: baceb988 user: mistachkin tags: trunk
19:34
Small performance optimization in the freeSpace() routine of btree.c. check-in: 63962e2a user: drh tags: trunk
17:39
Improved description of the ElseNotEq opcode in comments. No changes to code. check-in: e011435e user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/btree.c.

  1601   1601     ** spot on the list where iStart should be inserted.
  1602   1602     */
  1603   1603     hdr = pPage->hdrOffset;
  1604   1604     iPtr = hdr + 1;
  1605   1605     if( data[iPtr+1]==0 && data[iPtr]==0 ){
  1606   1606       iFreeBlk = 0;  /* Shortcut for the case when the freelist is empty */
  1607   1607     }else{
  1608         -    while( (iFreeBlk = get2byte(&data[iPtr]))>0 && iFreeBlk<iStart ){
  1609         -      if( iFreeBlk<iPtr+4 ) return SQLITE_CORRUPT_BKPT;
         1608  +    while( (iFreeBlk = get2byte(&data[iPtr]))<iStart ){
         1609  +      if( iFreeBlk<iPtr+4 ){
         1610  +        if( iFreeBlk==0 ) break;
         1611  +        return SQLITE_CORRUPT_BKPT;
         1612  +      }
  1610   1613         iPtr = iFreeBlk;
  1611   1614       }
  1612   1615       if( iFreeBlk>iLast ) return SQLITE_CORRUPT_BKPT;
  1613   1616       assert( iFreeBlk>iPtr || iFreeBlk==0 );
  1614   1617     
  1615   1618       /* At this point:
  1616   1619       **    iFreeBlk:   First freeblock after iStart, or zero if none