1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Avoid a test for CURTYPE_BTREE in sqlite3VdbeCursorMoveto() in order to reduce

the size and improve the performance of OP_Column.

FossilOrigin-Name: f078deb25149b7b1881b7f3374b343d0677e82336d8fdd7f1cdd06d926b5dd57
This commit is contained in:
drh
2017-08-16 19:20:20 +00:00
parent 1f613c4df3
commit fe0cf7a18c
8 changed files with 56 additions and 38 deletions

View File

@@ -2413,8 +2413,10 @@ case OP_Column: {
if( pC->cacheStatus!=p->cacheCtr ){ /*OPTIMIZATION-IF-FALSE*/
if( pC->nullRow ){
if( pC->eCurType==CURTYPE_PSEUDO ){
assert( pC->uc.pseudoTableReg>0 );
pReg = &aMem[pC->uc.pseudoTableReg];
/* For the special case of as pseudo-cursor, the seekResult field
** identifies the register that holds the record */
assert( pC->seekResult>0 );
pReg = &aMem[pC->seekResult];
assert( pReg->flags & MEM_Blob );
assert( memIsValid(pReg) );
pC->payloadSize = pC->szRow = pReg->n;
@@ -3628,8 +3630,13 @@ case OP_OpenPseudo: {
pCx = allocateCursor(p, pOp->p1, pOp->p3, -1, CURTYPE_PSEUDO);
if( pCx==0 ) goto no_mem;
pCx->nullRow = 1;
pCx->uc.pseudoTableReg = pOp->p2;
pCx->seekResult = pOp->p2;
pCx->isTable = 1;
/* Give this pseudo-cursor a fake BtCursor pointer so that pCx
** can be safely passed to sqlite3VdbeCursorMoveto(). This avoids a test
** for pCx->eCurType==CURTYPE_BTREE inside of sqlite3VdbeCursorMoveto()
** which is a performance optimization */
pCx->uc.pCursor = sqlite3BtreeFakeValidCursor();
assert( pOp->p5==0 );
break;
}