1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +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

@@ -1,5 +1,5 @@
C Change\spageInsertArray()\sand\spageFreeArray()\sso\sthat\sthey\suse\sthe\sCellArray\nobject\sand\scompute\scell\ssizes\sas\sneeded,\sresulting\sin\ssmaller\sand\sfaster\scode. C Avoid\sunnecessary\scachedCellSize()\scalls\sin\sthe\scell\spartition\sadjustment\nphase\sof\sbalance_nonroot().
D 2015-06-23T15:36:34.487 D 2015-06-23T16:00:24.052
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 1063c58075b7400d93326b0eb332b48a54f53025 F Makefile.in 1063c58075b7400d93326b0eb332b48a54f53025
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -192,7 +192,7 @@ F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240
F src/backup.c ff743689c4d6c5cb55ad42ed9d174b2b3e71f1e3 F src/backup.c ff743689c4d6c5cb55ad42ed9d174b2b3e71f1e3
F src/bitvec.c 5eb7958c3bf65210211cbcfc44eff86d0ded7c9d F src/bitvec.c 5eb7958c3bf65210211cbcfc44eff86d0ded7c9d
F src/btmutex.c 45a968cc85afed9b5e6cf55bf1f42f8d18107f79 F src/btmutex.c 45a968cc85afed9b5e6cf55bf1f42f8d18107f79
F src/btree.c d3299e9237047e7aaf2812f394dda4889f2e3aa9 F src/btree.c 57f16870792abb0cc921124f3ee064d6379d5c8d
F src/btree.h 969adc948e89e449220ff0ff724c94bb2a52e9f1 F src/btree.h 969adc948e89e449220ff0ff724c94bb2a52e9f1
F src/btreeInt.h 6ece2dd9c8e2eac05f0a8ded8772a44e96486c65 F src/btreeInt.h 6ece2dd9c8e2eac05f0a8ded8772a44e96486c65
F src/build.c b3f15255d5b16e42dafeaa638fd4f8a47c94ed70 F src/build.c b3f15255d5b16e42dafeaa638fd4f8a47c94ed70
@@ -1286,7 +1286,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P ee44bb25b2a88e25ba2afe37cf03ba199692a3a0 P f7f41818119bb7bfbd1f1297d294b32f32769cd3
R 5ed6484269ac715a433769ddc5808d8c R 37fa05f0f572512a3f64ce71dc3bcdd6
U drh U drh
Z fb1540dd92109cdc5f0c16d0ac49412f Z c91e3b72c83e00e6480937885f4355e3

View File

@@ -1 +1 @@
f7f41818119bb7bfbd1f1297d294b32f32769cd3 6319ee1256b1f7c39dd39a536a39b77b3d10dcac

View File

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