mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
Small performance improvement in the btreeOverwriteCell() routine.
FossilOrigin-Name: df5ea47130d275e9fa1bd6aa8d55f1d5e136cba30ba13b7ede22224aa7f78919
This commit is contained in:
14
manifest
14
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Add\ssome\sdocs\sexplaining\sa\sparticular\spiece\sof\s[ae0196d86ee8].\sNo\scode\schanges.
|
C Small\sperformance\simprovement\sin\sthe\sbtreeOverwriteCell()\sroutine.
|
||||||
D 2023-01-02T20:52:46.522
|
D 2023-01-03T15:11:01.142
|
||||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||||
@@ -584,7 +584,7 @@ F src/auth.c f4fa91b6a90bbc8e0d0f738aa284551739c9543a367071f55574681e0f24f8cf
|
|||||||
F src/backup.c a2891172438e385fdbe97c11c9745676bec54f518d4447090af97189fd8e52d7
|
F src/backup.c a2891172438e385fdbe97c11c9745676bec54f518d4447090af97189fd8e52d7
|
||||||
F src/bitvec.c 7c849aac407230278445cb069bebc5f89bf2ddd87c5ed9459b070a9175707b3d
|
F src/bitvec.c 7c849aac407230278445cb069bebc5f89bf2ddd87c5ed9459b070a9175707b3d
|
||||||
F src/btmutex.c 6ffb0a22c19e2f9110be0964d0731d2ef1c67b5f7fabfbaeb7b9dabc4b7740ca
|
F src/btmutex.c 6ffb0a22c19e2f9110be0964d0731d2ef1c67b5f7fabfbaeb7b9dabc4b7740ca
|
||||||
F src/btree.c 2f794c217e52fdf4322bf37ee7778331b4d93aed2c00b5d67f914c0239a9edcc
|
F src/btree.c cc4d9e293a22d08b27f12f04a325f798b60093943d8929de702f533c18c54a4e
|
||||||
F src/btree.h 49da925329574798be3cbb745a49d069a9e67c99900d8a0d04b1e934d60394ea
|
F src/btree.h 49da925329574798be3cbb745a49d069a9e67c99900d8a0d04b1e934d60394ea
|
||||||
F src/btreeInt.h 88ad499c92b489afedbfefc3f067c4d15023ec021afe622db240dc9d2277cfa5
|
F src/btreeInt.h 88ad499c92b489afedbfefc3f067c4d15023ec021afe622db240dc9d2277cfa5
|
||||||
F src/build.c c55ab6d1b089ceef57160e840f05f692955ac90944c3d04fcf01d97fd7bfd08d
|
F src/build.c c55ab6d1b089ceef57160e840f05f692955ac90944c3d04fcf01d97fd7bfd08d
|
||||||
@@ -2067,8 +2067,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
|||||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||||
P ae0196d86ee8ca424b5ef5a43c32988f4ab5131ea146669bc1467e31a2384901
|
P 7f96803c1cbd0633367173ab0a67a8b301b9e0746e460c50d506b536c15db0a0
|
||||||
R 468770ff1d6e218ca1a386beedb2179e
|
R 10289e6f8e31034fa806339dcdadfd2f
|
||||||
U stephan
|
U drh
|
||||||
Z d6968ffff8c57917bdc920258d7e0b7f
|
Z 4e108d77c081298b7689d1eafc6b59e1
|
||||||
# Remove this line to create a well-formed Fossil manifest.
|
# Remove this line to create a well-formed Fossil manifest.
|
||||||
|
@@ -1 +1 @@
|
|||||||
7f96803c1cbd0633367173ab0a67a8b301b9e0746e460c50d506b536c15db0a0
|
df5ea47130d275e9fa1bd6aa8d55f1d5e136cba30ba13b7ede22224aa7f78919
|
39
src/btree.c
39
src/btree.c
@@ -8914,9 +8914,13 @@ static int btreeOverwriteContent(
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
** Overwrite the cell that cursor pCur is pointing to with fresh content
|
** Overwrite the cell that cursor pCur is pointing to with fresh content
|
||||||
** contained in pX.
|
** contained in pX. In this variant, pCur is pointing to an overflow
|
||||||
|
** cell.
|
||||||
*/
|
*/
|
||||||
static int btreeOverwriteCell(BtCursor *pCur, const BtreePayload *pX){
|
static SQLITE_NOINLINE int btreeOverwriteOverflowCell(
|
||||||
|
BtCursor *pCur, /* Cursor pointing to cell to ovewrite */
|
||||||
|
const BtreePayload *pX /* Content to write into the cell */
|
||||||
|
){
|
||||||
int iOffset; /* Next byte of pX->pData to write */
|
int iOffset; /* Next byte of pX->pData to write */
|
||||||
int nTotal = pX->nData + pX->nZero; /* Total bytes of to write */
|
int nTotal = pX->nData + pX->nZero; /* Total bytes of to write */
|
||||||
int rc; /* Return code */
|
int rc; /* Return code */
|
||||||
@@ -8925,16 +8929,12 @@ static int btreeOverwriteCell(BtCursor *pCur, const BtreePayload *pX){
|
|||||||
Pgno ovflPgno; /* Next overflow page to write */
|
Pgno ovflPgno; /* Next overflow page to write */
|
||||||
u32 ovflPageSize; /* Size to write on overflow page */
|
u32 ovflPageSize; /* Size to write on overflow page */
|
||||||
|
|
||||||
if( pCur->info.pPayload + pCur->info.nLocal > pPage->aDataEnd
|
assert( pCur->info.nLocal<nTotal ); /* pCur is an overflow cell */
|
||||||
|| pCur->info.pPayload < pPage->aData + pPage->cellOffset
|
|
||||||
){
|
|
||||||
return SQLITE_CORRUPT_BKPT;
|
|
||||||
}
|
|
||||||
/* Overwrite the local portion first */
|
/* Overwrite the local portion first */
|
||||||
rc = btreeOverwriteContent(pPage, pCur->info.pPayload, pX,
|
rc = btreeOverwriteContent(pPage, pCur->info.pPayload, pX,
|
||||||
0, pCur->info.nLocal);
|
0, pCur->info.nLocal);
|
||||||
if( rc ) return rc;
|
if( rc ) return rc;
|
||||||
if( pCur->info.nLocal==nTotal ) return SQLITE_OK;
|
|
||||||
|
|
||||||
/* Now overwrite the overflow pages */
|
/* Now overwrite the overflow pages */
|
||||||
iOffset = pCur->info.nLocal;
|
iOffset = pCur->info.nLocal;
|
||||||
@@ -8964,6 +8964,29 @@ static int btreeOverwriteCell(BtCursor *pCur, const BtreePayload *pX){
|
|||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Overwrite the cell that cursor pCur is pointing to with fresh content
|
||||||
|
** contained in pX.
|
||||||
|
*/
|
||||||
|
static int btreeOverwriteCell(BtCursor *pCur, const BtreePayload *pX){
|
||||||
|
int nTotal = pX->nData + pX->nZero; /* Total bytes of to write */
|
||||||
|
MemPage *pPage = pCur->pPage; /* Page being written */
|
||||||
|
|
||||||
|
if( pCur->info.pPayload + pCur->info.nLocal > pPage->aDataEnd
|
||||||
|
|| pCur->info.pPayload < pPage->aData + pPage->cellOffset
|
||||||
|
){
|
||||||
|
return SQLITE_CORRUPT_BKPT;
|
||||||
|
}
|
||||||
|
if( pCur->info.nLocal==nTotal ){
|
||||||
|
/* The entire cell is local */
|
||||||
|
return btreeOverwriteContent(pPage, pCur->info.pPayload, pX,
|
||||||
|
0, pCur->info.nLocal);
|
||||||
|
}else{
|
||||||
|
/* The cell contains overflow content */
|
||||||
|
return btreeOverwriteOverflowCell(pCur, pX);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Insert a new record into the BTree. The content of the new record
|
** Insert a new record into the BTree. The content of the new record
|
||||||
|
Reference in New Issue
Block a user