Fix a performance regression in rtree introduced by the previous commit.

FossilOrigin-Name: 7f42b8e1a25c0830fe81e4668318998af595826784a50780a5c1c0b4d95a2482
This commit is contained in:
dan 2021-11-18 20:11:31 +00:00
parent 895c807a6d
commit 826ec6013c
3 changed files with 24 additions and 23 deletions

View File

@ -1285,32 +1285,33 @@ static void rtreeNonleafConstraint(
|| p->op==RTREE_FALSE );
assert( ((((char*)pCellData) - (char*)0)&3)==0 ); /* 4-byte aligned */
switch( p->op ){
case RTREE_TRUE: /* Always satisfied */
break;
case RTREE_FALSE: /* Never satisfied */
*peWithin = NOT_WITHIN;
break;
case RTREE_LE:
case RTREE_LT:
case RTREE_TRUE: return; /* Always satisfied */
case RTREE_FALSE: break; /* Never satisfied */
case RTREE_EQ:
RTREE_DECODE_COORD(eInt, pCellData, val);
/* val now holds the lower bound of the coordinate pair */
if( p->u.rValue<val ){
*peWithin = NOT_WITHIN;
break;
if( p->u.rValue>=val ){
pCellData += 4;
RTREE_DECODE_COORD(eInt, pCellData, val);
/* val now holds the upper bound of the coordinate pair */
if( p->u.rValue<=val ) return;
}
if( p->op!=RTREE_EQ ) break; /* RTREE_LE and RTREE_LT end here */
/* Fall through for the RTREE_EQ case */
break;
case RTREE_LE:
case RTREE_LT:
RTREE_DECODE_COORD(eInt, pCellData, val);
/* val now holds the lower bound of the coordinate pair */
if( p->u.rValue>=val ) return;
break;
default: /* RTREE_GT or RTREE_GE, or fallthrough of RTREE_EQ */
default:
pCellData += 4;
RTREE_DECODE_COORD(eInt, pCellData, val);
/* val now holds the upper bound of the coordinate pair */
if( p->u.rValue>val ){
*peWithin = NOT_WITHIN;
}
if( p->u.rValue<=val ) return;
break;
}
*peWithin = NOT_WITHIN;
}
/*

View File

@ -1,5 +1,5 @@
C Fix\sa\sproblem\sslowing\sdown\sthe\shandling\sof\s==\sconstraints\sin\sthe\srtree\smodule.
D 2021-11-18T19:15:40.541
C Fix\sa\sperformance\sregression\sin\srtree\sintroduced\sby\sthe\sprevious\scommit.
D 2021-11-18T20:11:31.718
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -395,7 +395,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 a7021cb524621573ccda213a35b0339371849dd4acc4909f689786ee1f964b7f
F ext/rtree/rtree.c c1731f33253199ede524592d0fbbd2220ac7cc3c1dcd3b5d08b68b7dcf8b7f2c
F ext/rtree/rtree.c d7b4b8b81d8d54376a7f81de5be85ec58b37c11604bcf42984a8418b34158d93
F ext/rtree/rtree.h 4a690463901cb5e6127cf05eb8e642f127012fd5003830dbc974eca5802d9412
F ext/rtree/rtree1.test 35c3bc0def71317b7601ee0d1149e7df2cd8fc4f13ec89a64761ac3f46ca123f
F ext/rtree/rtree2.test 9d9deddbb16fd0c30c36e6b4fdc3ee3132d765567f0f9432ee71e1303d32603d
@ -1933,7 +1933,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 b7927bf91049c903730a280484bbcdcdedc259a31fbcc3d3b0c7d046ec321633
R bc14a509a5e37dbab8e0eef05b4363ac
P 509027e964f28efca088a41fe32f01c38316f7a919de63a8835e3bc7c3fb0787
R c2cdaff31ea77237329e59841c0f182a
U dan
Z 827b0b30e8a22a49654c8ffaf9e8d5f4
Z 4c54e10f3cfe7975c8bc532dcc527100

View File

@ -1 +1 @@
509027e964f28efca088a41fe32f01c38316f7a919de63a8835e3bc7c3fb0787
7f42b8e1a25c0830fe81e4668318998af595826784a50780a5c1c0b4d95a2482