/ Check-in [aacbb9a4]
Login

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

Overview
Comment:Exploit the fact that Expr.pRight and Expr.x are never used at the same time for a small performance gain.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: aacbb9a461fdb34c7f9c8ce348e44c3e96c93334f210d438d92bfac1794dc686
User & Date: drh 2017-07-07 13:59:34
Context
2017-07-07
16:00
Enhance the sqlite3VdbeMultiLoad() interface to automatically generate the OP_ResultRow opcode on PRAGMA implementations, for a small reduction in the library footprint. check-in: c46f0f07 user: drh tags: trunk
15:43
Add new pragmas: "function_list" and "module_list" check-in: e5f01d7f user: drh tags: list-pragmas
14:26
Merge recent enhancements from trunk. check-in: 73d0fc02 user: drh tags: bind-pointer
13:59
Exploit the fact that Expr.pRight and Expr.x are never used at the same time for a small performance gain. check-in: aacbb9a4 user: drh tags: trunk
12:58
More efficient and compact implementation of walkExpr(). check-in: 115d4b83 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/expr.c.

  1021   1021       assert( p->x.pSelect==0 );
  1022   1022     }
  1023   1023   #endif
  1024   1024     if( !ExprHasProperty(p, (EP_TokenOnly|EP_Leaf)) ){
  1025   1025       /* The Expr.x union is never used at the same time as Expr.pRight */
  1026   1026       assert( p->x.pList==0 || p->pRight==0 );
  1027   1027       if( p->pLeft && p->op!=TK_SELECT_COLUMN ) sqlite3ExprDeleteNN(db, p->pLeft);
  1028         -    sqlite3ExprDelete(db, p->pRight);
  1029         -    if( ExprHasProperty(p, EP_xIsSelect) ){
         1028  +    if( p->pRight ){
         1029  +      sqlite3ExprDeleteNN(db, p->pRight);
         1030  +    }else if( ExprHasProperty(p, EP_xIsSelect) ){
  1030   1031         sqlite3SelectDelete(db, p->x.pSelect);
  1031   1032       }else{
  1032   1033         sqlite3ExprListDelete(db, p->x.pList);
  1033   1034       }
  1034   1035     }
  1035   1036     if( ExprHasProperty(p, EP_MemToken) ) sqlite3DbFree(db, p->u.zToken);
  1036   1037     if( !ExprHasProperty(p, EP_Static) ){

Changes to src/walker.c.

    40     40     int rc;
    41     41     testcase( ExprHasProperty(pExpr, EP_TokenOnly) );
    42     42     testcase( ExprHasProperty(pExpr, EP_Reduced) );
    43     43     rc = pWalker->xExprCallback(pWalker, pExpr);
    44     44     if( rc ) return rc & WRC_Abort;
    45     45     if( !ExprHasProperty(pExpr,(EP_TokenOnly|EP_Leaf)) ){
    46     46       if( pExpr->pLeft && walkExpr(pWalker, pExpr->pLeft) ) return WRC_Abort;
    47         -    if( pExpr->pRight && walkExpr(pWalker, pExpr->pRight) ) return WRC_Abort;
    48         -    if( ExprHasProperty(pExpr, EP_xIsSelect) ){
           47  +    assert( pExpr->x.pList==0 || pExpr->pRight==0 );
           48  +    if( pExpr->pRight ){
           49  +      if( walkExpr(pWalker, pExpr->pRight) ) return WRC_Abort;
           50  +    }else if( ExprHasProperty(pExpr, EP_xIsSelect) ){
    49     51         if( sqlite3WalkSelect(pWalker, pExpr->x.pSelect) ) return WRC_Abort;
    50     52       }else if( pExpr->x.pList ){
    51     53         if( sqlite3WalkExprList(pWalker, pExpr->x.pList) ) return WRC_Abort;
    52     54       }
    53     55     }
    54     56     return WRC_Continue;
    55     57   }