From: drh Date: Thu, 2 Jan 2014 21:05:10 +0000 (+0000) Subject: Try to factor constant subcomponents of the WHERE clause out of the loop. X-Git-Tag: version-3.8.3~66 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=759e8588117ef04a0ef331b0128e2a684049f00c;p=thirdparty%2Fsqlite.git Try to factor constant subcomponents of the WHERE clause out of the loop. FossilOrigin-Name: 9d05777fe24e1a5ce71762de38db840931ef0bc8 --- diff --git a/manifest b/manifest index b647b373c8..07bca20bb5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Avoid\sunnecessary\saffinity\stransformations\swhen\sbuilding\sindices\susing\ndata\sfrom\sa\stable. -D 2014-01-02T19:35:30.181 +C Try\sto\sfactor\sconstant\ssubcomponents\sof\sthe\sWHERE\sclause\sout\sof\sthe\sloop. +D 2014-01-02T21:05:10.654 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -293,7 +293,7 @@ F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd F src/wal.c 7dc3966ef98b74422267e7e6e46e07ff6c6eb1b4 F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c e9e593d5bb798c3e67fc3893dfe7055c9e7d8d74 -F src/where.c 60bc8c5b00e2292c24a42455d022eeeda33a16f1 +F src/where.c 8e3cb2030eaa242defb804aa30115b5d870e5cd4 F src/whereInt.h 96a75c61f1d2b9d4a8e4bb17d89deb0cf7cba358 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -1147,7 +1147,7 @@ F tool/vdbe-compress.tcl 0cf56e9263a152b84da86e75a5c0cdcdb7a47891 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P b7e39851a75b87ebca747b26a39989560fd6362b -R 8c4d4f58f19d587102e868c570c261da +P 10d851353c2abeadbd2852c210a7ff9f7f513e5d +R c2b1a12fe347b39aeab4feaef9309c2b U drh -Z 387b8179fd8db58dae028273b1bc8ad7 +Z c170c664d17a9fc9f22716e0d87d4dc7 diff --git a/manifest.uuid b/manifest.uuid index b39edb4e71..a55e61dfa1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -10d851353c2abeadbd2852c210a7ff9f7f513e5d \ No newline at end of file +9d05777fe24e1a5ce71762de38db840931ef0bc8 \ No newline at end of file diff --git a/src/where.c b/src/where.c index 59028b9921..0acc0db53f 100644 --- a/src/where.c +++ b/src/where.c @@ -5430,9 +5430,12 @@ WhereInfo *sqlite3WhereBegin( /* Special case: a WHERE clause that is constant. Evaluate the ** expression and either jump over all of the code or fall thru. */ - if( pWhere && (nTabList==0 || sqlite3ExprIsConstantNotJoin(pWhere)) ){ - sqlite3ExprIfFalse(pParse, pWhere, pWInfo->iBreak, SQLITE_JUMPIFNULL); - pWhere = 0; + for(ii=0; iinTerm; ii++){ + if( nTabList==0 || sqlite3ExprIsConstantNotJoin(sWLB.pWC->a[ii].pExpr) ){ + sqlite3ExprIfFalse(pParse, sWLB.pWC->a[ii].pExpr, pWInfo->iBreak, + SQLITE_JUMPIFNULL); + sWLB.pWC->a[ii].wtFlags |= TERM_CODED; + } } /* Special case: No FROM clause