mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Simplification to the insertCell() routine in btree.c, resulting in a
performance boost and a very small size decrease. It turns out that the extra work involved in sometimes avoiding an memcpy() of the first four bytes of a record takes more time than just unconditionally copying those four bytes. FossilOrigin-Name: 66de15580d3c289601e67debfe1edee286f4db5f
This commit is contained in:
12
manifest
12
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Require\sthe\sSQLITE_ENABLE_RTREE\scompile-time\soption\sin\sspeedtest1.c\sin\sorder\nto\senable\sthe\sR-Tree\stests.
|
C Simplification\sto\sthe\sinsertCell()\sroutine\sin\sbtree.c,\sresulting\sin\sa\nperformance\sboost\sand\sa\svery\ssmall\ssize\sdecrease.\s\sIt\sturns\sout\sthat\sthe\nextra\swork\sinvolved\sin\ssometimes\savoiding\san\smemcpy()\sof\sthe\sfirst\sfour\sbytes\nof\sa\srecord\stakes\smore\stime\sthan\sjust\sunconditionally\scopying\sthose\nfour\sbytes.
|
||||||
D 2014-10-11T10:52:54.590
|
D 2014-10-11T17:22:55.486
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a
|
F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@@ -172,7 +172,7 @@ F src/auth.c d8abcde53426275dab6243b441256fcd8ccbebb2
|
|||||||
F src/backup.c a31809c65623cc41849b94d368917f8bb66e6a7e
|
F src/backup.c a31809c65623cc41849b94d368917f8bb66e6a7e
|
||||||
F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb
|
F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb
|
||||||
F src/btmutex.c 49ca66250c7dfa844a4d4cb8272b87420d27d3a5
|
F src/btmutex.c 49ca66250c7dfa844a4d4cb8272b87420d27d3a5
|
||||||
F src/btree.c fa00618117fb6bb46c243452c56997c0d22d4fc9
|
F src/btree.c 5c0b78c49d00da49a0e8e3d2738900a431df7fca
|
||||||
F src/btree.h a79aa6a71e7f1055f01052b7f821bd1c2dce95c8
|
F src/btree.h a79aa6a71e7f1055f01052b7f821bd1c2dce95c8
|
||||||
F src/btreeInt.h 1bd7957161a1346a914f1f09231610e777a8e58d
|
F src/btreeInt.h 1bd7957161a1346a914f1f09231610e777a8e58d
|
||||||
F src/build.c 9e5205db9a0c8a1a4ce7379d60a2a34cb0b7339c
|
F src/build.c 9e5205db9a0c8a1a4ce7379d60a2a34cb0b7339c
|
||||||
@@ -1204,7 +1204,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
|||||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||||
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
|
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
|
||||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||||
P 7a32fdfd4be2138c0ab00f3dc6f54a70e4e07be4
|
P 5d29a033b0f17b0fd74656b28a8367a9a9067f81
|
||||||
R 4281e286fbeeaa18c9716d9bb0cdd63c
|
R 8d2ebada6cfcd93628f86065b0703bad
|
||||||
U drh
|
U drh
|
||||||
Z 50870d5e316ccf74380338fbaf696334
|
Z b915e33ee9cbdc5e832f0d58216a79da
|
||||||
|
@@ -1 +1 @@
|
|||||||
5d29a033b0f17b0fd74656b28a8367a9a9067f81
|
66de15580d3c289601e67debfe1edee286f4db5f
|
10
src/btree.c
10
src/btree.c
@@ -5845,11 +5845,6 @@ static void dropCell(MemPage *pPage, int idx, int sz, int *pRC){
|
|||||||
** in pTemp or the original pCell) and also record its index.
|
** in pTemp or the original pCell) and also record its index.
|
||||||
** Allocating a new entry in pPage->aCell[] implies that
|
** Allocating a new entry in pPage->aCell[] implies that
|
||||||
** pPage->nOverflow is incremented.
|
** pPage->nOverflow is incremented.
|
||||||
**
|
|
||||||
** If nSkip is non-zero, then do not copy the first nSkip bytes of the
|
|
||||||
** cell. The caller will overwrite them after this function returns. If
|
|
||||||
** nSkip is non-zero, then pCell may not point to an invalid memory location
|
|
||||||
** (but pCell+nSkip is always valid).
|
|
||||||
*/
|
*/
|
||||||
static void insertCell(
|
static void insertCell(
|
||||||
MemPage *pPage, /* Page into which we are copying */
|
MemPage *pPage, /* Page into which we are copying */
|
||||||
@@ -5866,7 +5861,6 @@ static void insertCell(
|
|||||||
int ins; /* Index in data[] where new cell pointer is inserted */
|
int ins; /* Index in data[] where new cell pointer is inserted */
|
||||||
int cellOffset; /* Address of first cell pointer in data[] */
|
int cellOffset; /* Address of first cell pointer in data[] */
|
||||||
u8 *data; /* The content of the whole page */
|
u8 *data; /* The content of the whole page */
|
||||||
int nSkip = (iChild ? 4 : 0);
|
|
||||||
|
|
||||||
if( *pRC ) return;
|
if( *pRC ) return;
|
||||||
|
|
||||||
@@ -5884,7 +5878,7 @@ static void insertCell(
|
|||||||
assert( sz==cellSizePtr(pPage, pCell) || (sz==8 && iChild>0) );
|
assert( sz==cellSizePtr(pPage, pCell) || (sz==8 && iChild>0) );
|
||||||
if( pPage->nOverflow || sz+2>pPage->nFree ){
|
if( pPage->nOverflow || sz+2>pPage->nFree ){
|
||||||
if( pTemp ){
|
if( pTemp ){
|
||||||
memcpy(pTemp+nSkip, pCell+nSkip, sz-nSkip);
|
memcpy(pTemp, pCell, sz);
|
||||||
pCell = pTemp;
|
pCell = pTemp;
|
||||||
}
|
}
|
||||||
if( iChild ){
|
if( iChild ){
|
||||||
@@ -5913,7 +5907,7 @@ static void insertCell(
|
|||||||
assert( idx+sz <= (int)pPage->pBt->usableSize );
|
assert( idx+sz <= (int)pPage->pBt->usableSize );
|
||||||
pPage->nCell++;
|
pPage->nCell++;
|
||||||
pPage->nFree -= (u16)(2 + sz);
|
pPage->nFree -= (u16)(2 + sz);
|
||||||
memcpy(&data[idx+nSkip], pCell+nSkip, sz-nSkip);
|
memcpy(&data[idx], pCell, sz);
|
||||||
if( iChild ){
|
if( iChild ){
|
||||||
put4byte(&data[idx], iChild);
|
put4byte(&data[idx], iChild);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user