/ Changes On Branch vdbe-aux-perf
Login

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

Changes In Branch vdbe-aux-perf Excluding Merge-Ins

This is equivalent to a diff from a5fa09657b to ff9eab9587

2017-01-10
15:08
Fix a potential assertion fault discovered by OSS-Fuzz. (check-in: 71c03b59b6 user: drh tags: trunk)
2017-01-09
20:57
Merge latest changes from trunk, and also move the perf-counter into the inner loop of sqlite3BtreeMovetoUnpacked(). (Leaf check-in: ff9eab9587 user: drh tags: vdbe-aux-perf)
19:55
Remove a redundant assignment statement. (check-in: a5fa09657b user: drh tags: trunk)
19:27
Performance optimization and size reduction in the OP_Variable opcode. (check-in: 237aa97452 user: drh tags: trunk)
2017-01-07
00:42
This hack illustrates how to use the VDBE_PROFILE mechanism to show which bytecode operators are using resources other than time. In this case, the number of loops through the binary search code in sqlite3BtreeMovetoUnpacked() is measured, for the purpose of helping to identify unnecessary btree searches. (check-in: 746b183683 user: drh tags: vdbe-aux-perf)

Changes to src/btree.c.

5137
5138
5139
5140
5141
5142
5143

5144
5145
5146
5147
5148
5149
5150
    upr = pPage->nCell-1;
    assert( biasRight==0 || biasRight==1 );
    idx = upr>>(1-biasRight); /* idx = biasRight ? upr : (lwr+upr)/2; */
    pCur->aiIdx[pCur->iPage] = (u16)idx;
    if( xRecordCompare==0 ){
      for(;;){
        i64 nCellKey;

        pCell = findCellPastPtr(pPage, idx);
        if( pPage->intKeyLeaf ){
          while( 0x80 <= *(pCell++) ){
            if( pCell>=pPage->aDataEnd ) return SQLITE_CORRUPT_BKPT;
          }
        }
        getVarint(pCell, (u64*)&nCellKey);







>







5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
    upr = pPage->nCell-1;
    assert( biasRight==0 || biasRight==1 );
    idx = upr>>(1-biasRight); /* idx = biasRight ? upr : (lwr+upr)/2; */
    pCur->aiIdx[pCur->iPage] = (u16)idx;
    if( xRecordCompare==0 ){
      for(;;){
        i64 nCellKey;
sqlite3PerfCnt++;
        pCell = findCellPastPtr(pPage, idx);
        if( pPage->intKeyLeaf ){
          while( 0x80 <= *(pCell++) ){
            if( pCell>=pPage->aDataEnd ) return SQLITE_CORRUPT_BKPT;
          }
        }
        getVarint(pCell, (u64*)&nCellKey);
5170
5171
5172
5173
5174
5175
5176

5177
5178
5179
5180
5181
5182
5183
        }
        assert( lwr+upr>=0 );
        idx = (lwr+upr)>>1;  /* idx = (lwr+upr)/2; */
      }
    }else{
      for(;;){
        int nCell;  /* Size of the pCell cell in bytes */

        pCell = findCellPastPtr(pPage, idx);

        /* The maximum supported page-size is 65536 bytes. This means that
        ** the maximum number of record bytes stored on an index B-Tree
        ** page is less than 16384 bytes and may be stored as a 2-byte
        ** varint. This information is used to attempt to avoid parsing 
        ** the entire cell by checking for the cases where the record is 







>







5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
        }
        assert( lwr+upr>=0 );
        idx = (lwr+upr)>>1;  /* idx = (lwr+upr)/2; */
      }
    }else{
      for(;;){
        int nCell;  /* Size of the pCell cell in bytes */
sqlite3PerfCnt++;
        pCell = findCellPastPtr(pPage, idx);

        /* The maximum supported page-size is 65536 bytes. This means that
        ** the maximum number of record bytes stored on an index B-Tree
        ** page is less than 16384 bytes and may be stored as a 2-byte
        ** varint. This information is used to attempt to avoid parsing 
        ** the entire cell by checking for the cases where the record is 

Changes to src/sqliteInt.h.

4316
4317
4318
4319
4320
4321
4322


4323
4324
#endif

int sqlite3ExprVectorSize(Expr *pExpr);
int sqlite3ExprIsVector(Expr *pExpr);
Expr *sqlite3VectorFieldSubexpr(Expr*, int);
Expr *sqlite3ExprForVectorField(Parse*,Expr*,int);
void sqlite3VectorErrorMsg(Parse*, Expr*);



#endif /* SQLITEINT_H */







>
>


4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
#endif

int sqlite3ExprVectorSize(Expr *pExpr);
int sqlite3ExprIsVector(Expr *pExpr);
Expr *sqlite3VectorFieldSubexpr(Expr*, int);
Expr *sqlite3ExprForVectorField(Parse*,Expr*,int);
void sqlite3VectorErrorMsg(Parse*, Expr*);

sqlite3_uint64 sqlite3PerfCnt;

#endif /* SQLITEINT_H */

Changes to src/vdbe.c.

502
503
504
505
506
507
508
509

510
511
512
513
514
515
516

#ifdef VDBE_PROFILE

/* 
** hwtime.h contains inline assembler code for implementing 
** high-performance timing routines.
*/
#include "hwtime.h"


#endif

#ifndef NDEBUG
/*
** This function is only called from within an assert() expression. It
** checks that the sqlite3.nTransaction variable is correctly set to







|
>







502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517

#ifdef VDBE_PROFILE

/* 
** hwtime.h contains inline assembler code for implementing 
** high-performance timing routines.
*/
/*#include "hwtime.h"*/
#define sqlite3Hwtime(x) sqlite3PerfCnt

#endif

#ifndef NDEBUG
/*
** This function is only called from within an assert() expression. It
** checks that the sqlite3.nTransaction variable is correctly set to