diff options
author | drh <drh@noemail.net> | 2016-12-06 22:47:23 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2016-12-06 22:47:23 +0000 |
commit | abfd35ea03475fab71b71e1320f103dc43cce523 (patch) | |
tree | b6cfaad80d8b8202d76222258efa16e6855ade2f /src/expr.c | |
parent | 2b519ab0155a0559888a571659b7a68e922db06d (diff) | |
download | sqlite-abfd35ea03475fab71b71e1320f103dc43cce523.tar.gz sqlite-abfd35ea03475fab71b71e1320f103dc43cce523.zip |
Performance improvement and size reduction in the Expr node allocator
function sqlite3PExpr().
FossilOrigin-Name: 2a81763e68cdf9b8c46389b1e1a87bc2084b53e7
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/expr.c b/src/expr.c index 1ad166777..881123e31 100644 --- a/src/expr.c +++ b/src/expr.c @@ -427,7 +427,7 @@ Expr *sqlite3ExprForVectorField( ** with the same pLeft pointer to the pVector, but only one of them ** will own the pVector. */ - pRet = sqlite3PExpr(pParse, TK_SELECT_COLUMN, 0, 0, 0); + pRet = sqlite3PExpr(pParse, TK_SELECT_COLUMN, 0, 0); if( pRet ){ pRet->iColumn = iField; pRet->pLeft = pVector; @@ -819,15 +819,19 @@ Expr *sqlite3PExpr( Parse *pParse, /* Parsing context */ int op, /* Expression opcode */ Expr *pLeft, /* Left operand */ - Expr *pRight, /* Right operand */ - const Token *pToken /* Argument token */ + Expr *pRight /* Right operand */ ){ Expr *p; if( op==TK_AND && pParse->nErr==0 ){ /* Take advantage of short-circuit false optimization for AND */ p = sqlite3ExprAnd(pParse->db, pLeft, pRight); }else{ - p = sqlite3ExprAlloc(pParse->db, op & TKFLG_MASK, pToken, 1); + p = sqlite3DbMallocRawNN(pParse->db, sizeof(Expr)); + if( p ){ + memset(p, 0, sizeof(Expr)); + p->op = op & TKFLG_MASK; + p->iAgg = -1; + } sqlite3ExprAttachSubtrees(pParse->db, p, pLeft, pRight); } if( p ) { |