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

Avoid unnecessary cachedCellSize() calls in the cell partition adjustment

phase of balance_nonroot().

FossilOrigin-Name: 6319ee1256b1f7c39dd39a536a39b77b3d10dcac
This commit is contained in:
drh
2015-06-23 16:00:24 +00:00
parent f783893b8d
commit 008d64c23a
3 changed files with 13 additions and 11 deletions

View File

@@ -7218,12 +7218,12 @@ static int balance_nonroot(
int r; /* Index of right-most cell in left sibling */
int d; /* Index of first cell to the left of right sibling */
r = cntNew[i-1] - 1;
d = r + 1 - leafData;
(void)cachedCellSize(&b, d);
while(1){
r = cntNew[i-1] - 1;
d = r + 1 - leafData;
assert( d<nMaxCells );
assert( r<nMaxCells );
(void)cachedCellSize(&b, d);
(void)cachedCellSize(&b, r);
if( szRight!=0
&& (bBulk || szRight+b.szCell[d]+2 > szLeft-(b.szCell[r]+2)) ){
@@ -7231,11 +7231,13 @@ static int balance_nonroot(
}
szRight += b.szCell[d] + 2;
szLeft -= b.szCell[r] + 2;
cntNew[i-1]--;
cntNew[i-1] = r;
if( cntNew[i-1] <= 0 ){
rc = SQLITE_CORRUPT_BKPT;
goto balance_cleanup;
}
r--;
d--;
}
szNew[i] = szRight;
szNew[i-1] = szLeft;