diff options
author | drh <> | 2024-07-05 01:05:34 +0000 |
---|---|---|
committer | drh <> | 2024-07-05 01:05:34 +0000 |
commit | 615fc1f0831c2910aac4c943d0dc33e8ed108c6b (patch) | |
tree | 08ba1d5993be49405413cdb46f9aa4cfccc35f9d /src | |
parent | a61f11f3074962fe4efb9a1e3478176829397961 (diff) | |
download | sqlite-615fc1f0831c2910aac4c943d0dc33e8ed108c6b.tar.gz sqlite-615fc1f0831c2910aac4c943d0dc33e8ed108c6b.zip |
Small performance optimizations.
FossilOrigin-Name: 99fd34b58a9b09af20f1f1a3c37137ae55159310c8af97806550eeee6adc4fc5
Diffstat (limited to 'src')
-rw-r--r-- | src/expr.c | 4 | ||||
-rw-r--r-- | src/sqliteInt.h | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/expr.c b/src/expr.c index 636cbd0fe..d012c3d5e 100644 --- a/src/expr.c +++ b/src/expr.c @@ -3436,6 +3436,7 @@ static int findCompatibleInRhsSubrtn( Vdbe *v; if( pNewSig==0 ) return 0; + if( pParse->bHasSubrtn==0 ) return 0; assert( pExpr->op==TK_IN ); assert( !ExprUseYSub(pExpr) ); assert( ExprUseXSelect(pExpr) ); @@ -3446,8 +3447,8 @@ static int findCompatibleInRhsSubrtn( pOp = sqlite3VdbeGetOp(v, 1); pEnd = sqlite3VdbeGetLastOp(v); for(; pOp<pEnd; pOp++){ - if( pOp->opcode!=OP_BeginSubrtn ) continue; if( pOp->p4type!=P4_SUBRTNSIG ) continue; + assert( pOp->opcode==OP_BeginSubrtn ); pSig = pOp->p4.pSubrtnSig; assert( pSig!=0 ); if( pNewSig->selId!=pSig->selId ) continue; @@ -3563,6 +3564,7 @@ void sqlite3CodeRhsOfIN( pSig->regReturn = pExpr->y.sub.regReturn; pSig->iTable = iTab; sqlite3VdbeChangeP4(v, -1, (const char*)pSig, P4_SUBRTNSIG); + pParse->bHasSubrtn = 1; } addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); } diff --git a/src/sqliteInt.h b/src/sqliteInt.h index df6774aef..323a257f6 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -3834,6 +3834,7 @@ struct Parse { u8 prepFlags; /* SQLITE_PREPARE_* flags */ u8 withinRJSubrtn; /* Nesting level for RIGHT JOIN body subroutines */ u8 bHasWith; /* True if statement contains WITH */ + u8 bHasSubrtn; /* True if any P4_SUBRTNSIG has been set */ #if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST) u8 earlyCleanup; /* OOM inside sqlite3ParserAddCleanup() */ #endif |