1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Performance improvement and size reduction in balance_nonroot().

FossilOrigin-Name: 715bc81eb833ad4834d139a04085e0386c54c30d7395207e48972c4dfe5879c1
This commit is contained in:
drh
2022-11-19 18:43:32 +00:00
parent 47de1f9e19
commit 16635fa777
3 changed files with 13 additions and 11 deletions

View File

@@ -8244,15 +8244,17 @@ static int balance_nonroot(
d = r + 1 - leafData;
(void)cachedCellSize(&b, d);
do{
int szR, szD;
assert( d<nMaxCells );
assert( r<nMaxCells );
(void)cachedCellSize(&b, r);
szR = cachedCellSize(&b, r);
szD = b.szCell[d];
if( szRight!=0
&& (bBulk || szRight+b.szCell[d]+2 > szLeft-(b.szCell[r]+(i==k-1?0:2)))){
&& (bBulk || szRight+szD+2 > szLeft-(szR+(i==k-1?0:2)))){
break;
}
szRight += b.szCell[d] + 2;
szLeft -= b.szCell[r] + 2;
szRight += szD + 2;
szLeft -= szR + 2;
cntNew[i-1] = r;
r--;
d--;