From 1efcc9dd965c5b48a1a9e27ce760b38f9d892cb4 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 5 Jul 2019 19:10:41 +0000 Subject: [PATCH] Another very small performance improvement. FossilOrigin-Name: 7a1e30a17f57ca006dd84b6f97b0c7811bf4c6da4b02903452ffc4bc363cab9b --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/prepare.c | 6 +++--- test/window2.tcl | 3 +++ test/window2.test | 4 ++++ 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index 5ba4ac2d79..3cf1f3b315 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Minor\stweak\sto\spatch\son\sthis\sbranch\sto\sreclaim\ssome\scycles. -D 2019-07-05T17:38:55.826 +C Another\svery\ssmall\sperformance\simprovement. +D 2019-07-05T19:10:41.614 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -517,7 +517,7 @@ F src/pcache.h 4f87acd914cef5016fae3030343540d75f5b85a1877eed1a2a19b9f284248586 F src/pcache1.c be64b2f3908a7f97c56c963676eb12f0d6254c95b28cdc1d73a186eff213219d F src/pragma.c 925bcac0afd98a0d4255c7524b93239ab4d83893d96f7f8fdccd78d4929a39bb F src/pragma.h 4a9fabff14db4487a734dfeeb4be984ce662bfdccfae16145b9c732327735e13 -F src/prepare.c 78027c6231fbb19ca186a5f5f0c0a1375d9c2cec0655273f9bd90d9ff74a34b3 +F src/prepare.c d633c3610c23dc98239ea445803c2a6188c2b8ab647e3df4243f369516e6c8d1 F src/printf.c 9be6945837c839ba57837b4bc3af349eba630920fa5532aa518816defe42a7d4 F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384 F src/resolve.c 3c0dc44956a909e135b92e7691e77fb7cf65ab55f03f0439b4e9758b29841fda @@ -1699,8 +1699,8 @@ F test/win32lock.test fbf107c91d8f5512be5a5b87c4c42ab9fdd54972 F test/win32longpath.test 169c75a3b2e43481f4a62122510210c67b08f26d F test/win32nolock.test ac4f08811a562e45a5755e661f45ca85892bdbbc F test/window1.test 8d453bfaa3f8f0873ba16ca1270c7368f18445065a0003a1b5954ac4e95797b4 -F test/window2.tcl a0de5e1e50538a9c491d894474d4708bbb2a3c043107ac5e05be7de99373a237 -F test/window2.test d7236a84c9104319fb0980a73565559d5470beb65d11136c5c1356d67de299c9 +F test/window2.tcl a44834af6267be6e14882311ef8790bf5047f1b9bc25685ee1762d48dc24f1e7 +F test/window2.test 2f3ae63e171dce7f2ac29a41020f4da413b1d7bdaba48ee124fd336b152e34c5 F test/window3.tcl acea6e86a4324a210fd608d06741010ca83ded9fde438341cb978c49928faf03 F test/window3.test e9959a993c8a71e96433be8daaa1827d78b8921e4f12debd7bdbeb3c856ef3cb F test/window4.tcl 5fbaab489677914ee5686b2008426e336daf88a2f58be7df92757f780a5ebf91 @@ -1833,7 +1833,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 28aa1702f7f0334abd1b30e7aa48ea3679539b11bfbba32bc9f0d6049cf18a7b -R 32352038f0215cf6311f9df6007b16f8 +P 81eed055de856068109a7e332cca0c3ff1120ebe2bfa5ed6383b165c726e0a7c +R 46b156a94f9cfdf367fb299674af587d U dan -Z 0e8a7c5368f99c56c1c2d766fdc13e32 +Z 61e3b9e66b66516dc5ac189aabd81a74 diff --git a/manifest.uuid b/manifest.uuid index 4b6312c88e..9481a3b9f0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -81eed055de856068109a7e332cca0c3ff1120ebe2bfa5ed6383b165c726e0a7c \ No newline at end of file +7a1e30a17f57ca006dd84b6f97b0c7811bf4c6da4b02903452ffc4bc363cab9b \ No newline at end of file diff --git a/src/prepare.c b/src/prepare.c index 3f1a79b14b..f385c1fc71 100644 --- a/src/prepare.c +++ b/src/prepare.c @@ -635,7 +635,7 @@ static int sqlite3Prepare( rc = sParse.rc; #ifndef SQLITE_OMIT_EXPLAIN - if( rc==SQLITE_OK && sParse.pVdbe && sParse.explain ){ + if( sParse.explain && rc==SQLITE_OK && sParse.pVdbe ){ static const char * const azColName[] = { "addr", "opcode", "p1", "p2", "p3", "p4", "p5", "comment", "id", "parent", "notused", "detail" @@ -660,8 +660,8 @@ static int sqlite3Prepare( if( db->init.busy==0 ){ sqlite3VdbeSetSql(sParse.pVdbe, zSql, (int)(sParse.zTail-zSql), prepFlags); } - if( sParse.pVdbe && (rc!=SQLITE_OK || db->mallocFailed) ){ - sqlite3VdbeFinalize(sParse.pVdbe); + if( rc!=SQLITE_OK || db->mallocFailed ){ + if( sParse.pVdbe ) sqlite3VdbeFinalize(sParse.pVdbe); assert(!(*ppStmt)); }else{ *ppStmt = (sqlite3_stmt*)sParse.pVdbe; diff --git a/test/window2.tcl b/test/window2.tcl index 3f781a7252..60bf68196c 100644 --- a/test/window2.tcl +++ b/test/window2.tcl @@ -428,6 +428,9 @@ execsql_test 4.10 { SELECT count(*) OVER (ORDER BY b) FROM t1 } +execsql_test 4.11 { + SELECT count(distinct a) FILTER (WHERE b='odd') FROM t1 +} finish_test diff --git a/test/window2.test b/test/window2.test index 26370e24d2..c4358ded74 100644 --- a/test/window2.test +++ b/test/window2.test @@ -897,4 +897,8 @@ do_execsql_test 4.10 { SELECT count(*) OVER (ORDER BY b) FROM t1 } {3 3 3 6 6 6} +do_execsql_test 4.11 { + SELECT count(distinct a) FILTER (WHERE b='odd') FROM t1 +} {3} + finish_test