SQLite

Check-in [55e5bfa231]
Login

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

Overview
Comment:Optimize the skipping of the payload size field when doing a binary search for a rowid.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | btree-optimization
Files: files | file ages | folders
SHA1: 55e5bfa231dd52a7cf9ec982967da4963867b9e5
User & Date: drh 2013-11-25 16:52:59.279
Context
2013-11-25
17:38
Uses shifts rather than division for arithmetic on the cell indices, since those indices are always non-negative. (check-in: 5bf2a3feeb user: drh tags: btree-optimization)
16:52
Optimize the skipping of the payload size field when doing a binary search for a rowid. (check-in: 55e5bfa231 user: drh tags: btree-optimization)
16:23
Arrange for sqlite3BtreeMovetoUnpacked() to always leave the cursor cell parse cache invalidated. This fixes issues with previous check-ins on this branch and also runs faster. (check-in: a74675607f user: drh tags: btree-optimization)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/btree.c.
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
    ** a moveToChild() or moveToRoot() call would have detected corruption.  */
    assert( pPage->nCell>0 );
    assert( pPage->intKey==(pIdxKey==0) );
    lwr = 0;
    upr = pPage->nCell-1;
    idx = biasRight ? upr : upr/2;
    pCur->aiIdx[pCur->iPage] = (u16)idx;
//    pCur->info.nSize = 0;
    if( pPage->intKey ){
      for(;;){
        i64 nCellKey;
        pCell = findCell(pPage, idx) + pPage->childPtrSize;
        if( pPage->hasData ){
          u32 dummy;
          pCell += getVarint32(pCell, dummy);
        }
        getVarint(pCell, (u64*)&nCellKey);
        if( nCellKey<intKey ){
          lwr = idx+1;
          if( lwr>upr ){ c = -1; break; }
        }else if( nCellKey>intKey ){
          upr = idx-1;







<





<
|







4660
4661
4662
4663
4664
4665
4666

4667
4668
4669
4670
4671

4672
4673
4674
4675
4676
4677
4678
4679
    ** a moveToChild() or moveToRoot() call would have detected corruption.  */
    assert( pPage->nCell>0 );
    assert( pPage->intKey==(pIdxKey==0) );
    lwr = 0;
    upr = pPage->nCell-1;
    idx = biasRight ? upr : upr/2;
    pCur->aiIdx[pCur->iPage] = (u16)idx;

    if( pPage->intKey ){
      for(;;){
        i64 nCellKey;
        pCell = findCell(pPage, idx) + pPage->childPtrSize;
        if( pPage->hasData ){

          while( 0x80 <= *(pCell++) && pCell<pPage->aDataEnd ){}
        }
        getVarint(pCell, (u64*)&nCellKey);
        if( nCellKey<intKey ){
          lwr = idx+1;
          if( lwr>upr ){ c = -1; break; }
        }else if( nCellKey>intKey ){
          upr = idx-1;