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

Slight performance improvement in the OP_Column opcode.

FossilOrigin-Name: 5c157474391f90f24e8867c77fbc6564c7955ecc
This commit is contained in:
drh
2016-05-20 19:51:28 +00:00
parent d20b2a4109
commit a1851efc5d
3 changed files with 12 additions and 9 deletions

View File

@@ -2575,9 +2575,10 @@ case OP_Column: {
assert( p2<pC->nHdrParsed );
assert( rc==SQLITE_OK );
assert( sqlite3VdbeCheckMemInvariants(pDest) );
if( VdbeMemDynamic(pDest) ) sqlite3VdbeMemSetNull(pDest);
if( VdbeMemDynamic(pDest) ){
sqlite3VdbeMemSetNull(pDest);
}
assert( t==pC->aType[p2] );
pDest->enc = encoding;
if( pC->szRow>=aOffset[p2+1] ){
/* This is the common case where the desired content fits on the original
** page - where the content is not on an overflow page */
@@ -2591,6 +2592,7 @@ case OP_Column: {
*/
static const u16 aFlag[] = { MEM_Blob, MEM_Str|MEM_Term };
pDest->n = len = (t-12)/2;
pDest->enc = encoding;
if( pDest->szMalloc < len+2 ){
pDest->flags = MEM_Null;
if( sqlite3VdbeMemGrow(pDest, len+2, 0) ) goto no_mem;
@@ -2603,6 +2605,7 @@ case OP_Column: {
pDest->flags = aFlag[t&1];
}
}else{
pDest->enc = encoding;
/* This branch happens only when content is on overflow pages */
if( ((pOp->p5 & (OPFLAG_LENGTHARG|OPFLAG_TYPEOFARG))!=0
&& ((t>=12 && (t&1)==0) || (pOp->p5 & OPFLAG_TYPEOFARG)!=0))