/ Check-in [be05d0db]
Login

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

Overview
Comment:Faster implementation of sqlite3IsBinary().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | propagate-const-opt
Files: files | file ages | folders
SHA3-256:be05d0db09f43cc3362c28273463d1d236af737a4f8a494cf1050da07ed0df47
User & Date: drh 2018-07-27 18:12:40
Context
2018-07-27
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
17:51
Only run the constant propagation optimization on joins since that is the only scenario where it is useful. This saves prepare time for the common case of a simple query. check-in: 598d6083 user: drh tags: propagate-const-opt
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/expr.c.

   324    324       if( !pColl ){
   325    325         pColl = sqlite3ExprCollSeq(pParse, pRight);
   326    326       }
   327    327     }
   328    328     return pColl;
   329    329   }
   330    330   
   331         -/*
   332         -** Return true if CollSeq is the default built-in BINARY.
   333         -*/
   334         -int sqlite3IsBinary(const CollSeq *p){
   335         -  return p==0 || sqlite3StrICmp(p->zName,sqlite3StrBINARY)==0;
   336         -}
   337         -
   338    331   /*
   339    332   ** Generate code for a comparison operator.
   340    333   */
   341    334   static int codeCompare(
   342    335     Parse *pParse,    /* The parsing (and code generating) context */
   343    336     Expr *pLeft,      /* The left operand */
   344    337     Expr *pRight,     /* The right operand */
................................................................................
  3588   3581           return target;
  3589   3582         }
  3590   3583         /* Otherwise, fall thru into the TK_COLUMN case */
  3591   3584       }
  3592   3585       case TK_COLUMN: {
  3593   3586         int iTab = pExpr->iTable;
  3594   3587         if( ExprHasProperty(pExpr, EP_FixedCol) ){
  3595         -        pExpr = pExpr->pLeft;
  3596         -        goto expr_code_doover;
         3588  +        return sqlite3ExprCodeTarget(pParse, pExpr->pLeft,target);
  3597   3589         }
  3598   3590         if( iTab<0 ){
  3599   3591           if( pParse->iSelfTab<0 ){
  3600   3592             /* Generating CHECK constraints or inserting into partial index */
  3601   3593             return pExpr->iColumn - pParse->iSelfTab;
  3602   3594           }else{
  3603   3595             /* Coding an expression that is part of an index where column names

Changes to src/main.c.

   905    905         */
   906    906       }else{
   907    907         rc = nKey1 - nKey2;
   908    908       }
   909    909     }
   910    910     return rc;
   911    911   }
          912  +
          913  +/*
          914  +** Return true if CollSeq is the default built-in BINARY.
          915  +*/
          916  +int sqlite3IsBinary(const CollSeq *p){
          917  +  assert( p==0 || p->xCmp!=binCollFunc || p->pUser!=0
          918  +            || strcmp(p->zName,"BINARY")==0 );
          919  +  return p==0 || (p->xCmp==binCollFunc && p->pUser==0);
          920  +}
   912    921   
   913    922   /*
   914    923   ** Another built-in collating sequence: NOCASE. 
   915    924   **
   916    925   ** This collating sequence is intended to be used for "case independent
   917    926   ** comparison". SQLite's knowledge of upper and lower case equivalents
   918    927   ** extends only to the 26 characters used in the English language.