/ Check-in [a5f86f49]
Login

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

Overview
Comment:Performance improvement to sqlite3ExprCollSeq(). With this change, the performance of speed-check.sh is within 400,000 cycles of trunk.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | propagate-const-opt
Files: files | file ages | folders
SHA3-256: a5f86f49b7d9e52546f234f7c3bcbac6b0f78aa55a71c44ca69e21bc31139f3e
User & Date: drh 2018-07-27 18:19:12
Context
2018-07-27
20:01
Reduce the performance cost of the constant propagation optimization to less than 200,000 cycles. Closed-Leaf check-in: 865249de user: drh tags: propagate-const-opt
18:19
Performance improvement to sqlite3ExprCollSeq(). With this change, the performance of speed-check.sh is within 400,000 cycles of trunk. check-in: a5f86f49 user: drh tags: propagate-const-opt
18:12
Faster implementation of sqlite3IsBinary(). check-in: be05d0db user: drh tags: propagate-const-opt
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/expr.c.

   137    137   CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr){
   138    138     sqlite3 *db = pParse->db;
   139    139     CollSeq *pColl = 0;
   140    140     Expr *p = pExpr;
   141    141     while( p ){
   142    142       int op = p->op;
   143    143       if( p->flags & EP_Generic ) break;
   144         -    if( op==TK_CAST || op==TK_UPLUS ){
   145         -      p = p->pLeft;
   146         -      continue;
   147         -    }
   148         -    if( op==TK_COLLATE || (op==TK_REGISTER && p->op2==TK_COLLATE) ){
   149         -      pColl = sqlite3GetCollSeq(pParse, ENC(db), 0, p->u.zToken);
   150         -      break;
   151         -    }
   152    144       if( (op==TK_AGG_COLUMN || op==TK_COLUMN
   153    145             || op==TK_REGISTER || op==TK_TRIGGER)
   154    146        && p->pTab!=0
   155    147       ){
   156    148         /* op==TK_REGISTER && p->pTab!=0 happens when pExpr was originally
   157    149         ** a TK_COLUMN but was previously evaluated and cached in a register */
   158    150         int j = p->iColumn;
   159    151         if( j>=0 ){
   160    152           const char *zColl = p->pTab->aCol[j].zColl;
   161    153           pColl = sqlite3FindCollSeq(db, ENC(db), zColl, 0);
   162    154         }
   163    155         break;
          156  +    }
          157  +    if( op==TK_CAST || op==TK_UPLUS ){
          158  +      p = p->pLeft;
          159  +      continue;
          160  +    }
          161  +    if( op==TK_COLLATE || (op==TK_REGISTER && p->op2==TK_COLLATE) ){
          162  +      pColl = sqlite3GetCollSeq(pParse, ENC(db), 0, p->u.zToken);
          163  +      break;
   164    164       }
   165    165       if( p->flags & EP_Collate ){
   166    166         if( p->pLeft && (p->pLeft->flags & EP_Collate)!=0 ){
   167    167           p = p->pLeft;
   168    168         }else{
   169    169           Expr *pNext  = p->pRight;
   170    170           /* The Expr.x union is never used at the same time as Expr.pRight */