From: drh Date: Mon, 9 Jan 2017 18:20:45 +0000 (+0000) Subject: Try to move OP_Concat operations outside the inner loop. This turns out X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fheads%2Ffailed-optimization;p=thirdparty%2Fsqlite.git Try to move OP_Concat operations outside the inner loop. This turns out to make things very slightly slower, at least in speedtest1.c. FossilOrigin-Name: 8a90f69139f7014ed53303814772f9f3efbc4f79 --- diff --git a/manifest b/manifest index 5fc4d50822..d68488f7a0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Modify\sthe\sOP_RowData\sopcode\sso\sthat\swhen\sP3!=0\sit\sis\sallowed\sto\shold\san\nephemeral\scopy\sof\sthe\scontent.\s\sThis\savoids\sunnecessary\smemcpy()\soperations\nin\sthe\sxfer-optimization\sand\sVACUUM. -D 2017-01-09T15:44:25.721 +C Try\sto\smove\sOP_Concat\soperations\soutside\sthe\sinner\sloop.\s\sThis\sturns\sout\nto\smake\sthings\svery\sslightly\sslower,\sat\sleast\sin\sspeedtest1.c. +D 2017-01-09T18:20:45.545 F Makefile.in 41bd4cad981487345c4a84081074bcdb876e4b2e F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc b8ca53350ae545e3562403d5da2a69cec79308da @@ -341,7 +341,7 @@ F src/ctime.c 9f2296a4e5d26ebf0e0d95a0af4628f1ea694e7a F src/date.c dc3f1391d9297f8c748132813aaffcb117090d6e F src/dbstat.c 19ee7a4e89979d4df8e44cfac7a8f905ec89b77d F src/delete.c a84f6229ccb9448460c287248024ceb70e10baab -F src/expr.c f06f41e5e5daca10fb090e70a2502dcc0dbc992b +F src/expr.c e559c6c1a0a0709aa056ea919dae0430956b890e F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c 2e9aabe1aee76273aff8a84ee92c464e095400ae F src/func.c c67273e1ec08abbdcc14c189892a3ff6eeece86b @@ -1543,7 +1543,10 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P a5fe03bc419d9c7e6068ed38810e3f183de179b5 -R 1f3e0de052f41632eb2fb92e1db69d89 +P 6e106acd74da3baa5c308a76443d2f0a7c904e5e +R 9f6dfb3523e9de7aca6ed8bcaf1ea804 +T *branch * failed-optimization +T *sym-failed-optimization * +T -sym-trunk * U drh -Z 8ba5841c95779521fe8c2f52b8a5492f +Z 56c063ac5b216f23ecc2133640602b56 diff --git a/manifest.uuid b/manifest.uuid index 78d290dd0b..87a7a66fb5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6e106acd74da3baa5c308a76443d2f0a7c904e5e \ No newline at end of file +8a90f69139f7014ed53303814772f9f3efbc4f79 \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index 154d078ff7..0ede44fe89 100644 --- a/src/expr.c +++ b/src/expr.c @@ -3514,6 +3514,12 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){ } break; } + case TK_CONCAT: { + if( ConstFactorOk(pParse) && sqlite3ExprIsConstantNotJoin(pExpr) ){ + /* Try to run CONCAT operations at outside the inner loop */ + return sqlite3ExprCodeAtInit(pParse, pExpr, -1); + } + } case TK_AND: case TK_OR: case TK_PLUS: @@ -3524,8 +3530,7 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){ case TK_BITOR: case TK_SLASH: case TK_LSHIFT: - case TK_RSHIFT: - case TK_CONCAT: { + case TK_RSHIFT: { assert( TK_AND==OP_And ); testcase( op==TK_AND ); assert( TK_OR==OP_Or ); testcase( op==TK_OR ); assert( TK_PLUS==OP_Add ); testcase( op==TK_PLUS );