1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

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;
}
/*