From 386e359044adf0d6e89333320985a37cdcd5786b Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 13 Sep 2023 12:06:02 +0000 Subject: [PATCH] Reduce the number of calls to cellArea() in the ChooseLeaf() algorithm of rtree. FossilOrigin-Name: c633fe6be0edc07a0aa1ac819d58b6c629b7c95b47b63516ae1b0a937f6a2b89 --- ext/rtree/rtree.c | 26 +++++++------------------- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 14 insertions(+), 26 deletions(-) diff --git a/ext/rtree/rtree.c b/ext/rtree/rtree.c index 0ce7fac4d4..b2e8b3b65b 100644 --- a/ext/rtree/rtree.c +++ b/ext/rtree/rtree.c @@ -2175,18 +2175,6 @@ static int cellContains(Rtree *pRtree, RtreeCell *p1, RtreeCell *p2){ return 1; } -/* -** Return the amount cell p would grow by if it were unioned with pCell. -*/ -static RtreeDValue cellGrowth(Rtree *pRtree, RtreeCell *p, RtreeCell *pCell){ - RtreeDValue area; - RtreeCell cell; - memcpy(&cell, p, sizeof(RtreeCell)); - area = cellArea(pRtree, &cell); - cellUnion(pRtree, &cell, pCell); - return (cellArea(pRtree, &cell)-area); -} - static RtreeDValue cellOverlap( Rtree *pRtree, RtreeCell *p, @@ -2238,7 +2226,6 @@ static int ChooseLeaf( RtreeDValue fMinArea = RTREE_ZERO; int nCell = NCELL(pNode); - RtreeCell cell; RtreeNode *pChild = 0; /* Select the child node which will be enlarged the least if pCell @@ -2246,16 +2233,17 @@ static int ChooseLeaf( ** the smallest area. */ for(iCell=0; iCell