From: drh <> Date: Wed, 13 Sep 2023 14:07:07 +0000 (+0000) Subject: Performance optimization to cellContains() in RTREE. X-Git-Tag: version-3.44.0~193^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f9967cb302aecd3cde25113823d85839494cf658;p=thirdparty%2Fsqlite.git Performance optimization to cellContains() in RTREE. FossilOrigin-Name: 43cde22bf3f36687df231eddf642581d1d4f4102ad8568d31f5b2ff0302ca800 --- diff --git a/ext/rtree/rtree.c b/ext/rtree/rtree.c index 5a1450801f..356aead4a4 100644 --- a/ext/rtree/rtree.c +++ b/ext/rtree/rtree.c @@ -2162,14 +2162,17 @@ static void cellUnion(Rtree *pRtree, RtreeCell *p1, RtreeCell *p2){ */ static int cellContains(Rtree *pRtree, RtreeCell *p1, RtreeCell *p2){ int ii; - int isInt = (pRtree->eCoordType==RTREE_COORD_INT32); - for(ii=0; iinDim2; ii+=2){ - RtreeCoord *a1 = &p1->aCoord[ii]; - RtreeCoord *a2 = &p2->aCoord[ii]; - if( (!isInt && (a2[0].fa1[1].f)) - || ( isInt && (a2[0].ia1[1].i)) - ){ - return 0; + if( pRtree->eCoordType==RTREE_COORD_INT32 ){ + for(ii=0; iinDim2; ii+=2){ + RtreeCoord *a1 = &p1->aCoord[ii]; + RtreeCoord *a2 = &p2->aCoord[ii]; + if( a2[0].ia1[1].i ) return 0; + } + }else{ + for(ii=0; iinDim2; ii+=2){ + RtreeCoord *a1 = &p1->aCoord[ii]; + RtreeCoord *a2 = &p2->aCoord[ii]; + if( a2[0].fa1[1].f ) return 0; } } return 1; diff --git a/manifest b/manifest index d5c9bfae1c..34311c2b2d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\sthe\sChooseLeaf\salgorithm\sof\sRTREE,\sdo\san\sinitial\spass\sthrough\sthe\scells\nof\sa\snode\slooking\sfor\ssolutions\sthat\sinvolve\sno\scell\senlargement.\s\sOnly\slook\nfor\sthe\sminimum\scell\senlargement\sif\sthe\senlargement\sis\snon-zero\sfor\sall\scells.\nThis\sresults\sin\sa\sperformance\simprovement\sby\sreducing\sthe\snumber\sof\scalls\nto\scellUnion(). -D 2023-09-13T13:12:08.325 +C Performance\soptimization\sto\scellContains()\sin\sRTREE. +D 2023-09-13T14:07:07.116 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -471,7 +471,7 @@ F ext/repair/test/checkindex01.test b530f141413b587c9eb78ff734de6bb79bc3515c3350 F ext/repair/test/test.tcl 686d76d888dffd021f64260abf29a55c57b2cedfa7fc69150b42b1d6119aac3c F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761 F ext/rtree/geopoly.c 971e0b5bd9adaf0811feb8c0842a310811159da10319eb0e74fdb42bf26b99ca -F ext/rtree/rtree.c 14e745969e69f128b27c3106318fd9bb5f87eb00c5bfdd5ccbb60a1872deb5b7 +F ext/rtree/rtree.c 461502ef5fa031e5fc7837377b23bfae24934414a88f6bf5505921864aae788f F ext/rtree/rtree.h 4a690463901cb5e6127cf05eb8e642f127012fd5003830dbc974eca5802d9412 F ext/rtree/rtree1.test 877d40b8b61b1f88cec9d4dc0ff8334f5b05299fac12a35141532e2881860e9d F ext/rtree/rtree2.test 9d9deddbb16fd0c30c36e6b4fdc3ee3132d765567f0f9432ee71e1303d32603d @@ -2119,8 +2119,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c633fe6be0edc07a0aa1ac819d58b6c629b7c95b47b63516ae1b0a937f6a2b89 -R c022f3599d3f41d22b9b1469e98905ec +P 59f0e239d19393190911ea3bd89b5a24be0d85d64ccf51906efc9537ad5d7298 +R e9b5b4a1842b9ceb8d187565fea4e7e6 U drh -Z 4cc63f132e0276d1f1f57289f0e4433b +Z cf6aeb5bc7687975d4feb7bd21780d1c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 8422100f5d..079c97127f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -59f0e239d19393190911ea3bd89b5a24be0d85d64ccf51906efc9537ad5d7298 \ No newline at end of file +43cde22bf3f36687df231eddf642581d1d4f4102ad8568d31f5b2ff0302ca800 \ No newline at end of file