mirror of
https://github.com/sqlite/sqlite.git
synced 2025-12-24 14:17:58 +03:00
Reduce the size of the CellInfo object from 32 to 24 bytes on 64-bit machines,
for a small performance increase and library size reduction. FossilOrigin-Name: 6a4cfc7ab62046eb718ce59eff6b632f239312ac
This commit is contained in:
16
manifest
16
manifest
@@ -1,5 +1,5 @@
|
||||
C Enhance\sthe\scommand-line\sshell\sso\sthat\sit\scan\shandle\sMBCS\scharacters\son\s\ninput\sand\soutput.
|
||||
D 2015-12-30T17:03:40.996
|
||||
C Reduce\sthe\ssize\sof\sthe\sCellInfo\sobject\sfrom\s32\sto\s24\sbytes\son\s64-bit\smachines,\nfor\sa\ssmall\sperformance\sincrease\sand\slibrary\ssize\sreduction.
|
||||
D 2015-12-30T18:18:46.481
|
||||
F Makefile.in 28bcd6149e050dff35d4dcfd97e890cd387a499d
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc 5fff077fcc46de7714ed6eebb6159a4c00eab751
|
||||
@@ -276,9 +276,9 @@ F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240
|
||||
F src/backup.c 2869a76c03eb393ee795416e2387005553df72bc
|
||||
F src/bitvec.c 1a78d450a17c5016710eec900bedfc5729bf9bdf
|
||||
F src/btmutex.c 45a968cc85afed9b5e6cf55bf1f42f8d18107f79
|
||||
F src/btree.c 84ede51e371a11c3dbb3e24ccc5e3e99594a6c00
|
||||
F src/btree.c 5ac3f868d4f20a67f0f00a1014940f902b511558
|
||||
F src/btree.h 2d76dee44704c47eed323356a758662724b674a0
|
||||
F src/btreeInt.h 3ab435ed27adea54d040584b0bcc488ee7db1e38
|
||||
F src/btreeInt.h b5f2651b41808f038dee9282c5dc0232ce6532d3
|
||||
F src/build.c 5a8611a01cbf67c736d81304e054ec361ef8963d
|
||||
F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0
|
||||
F src/complete.c addcd8160b081131005d5bc2d34adf20c1c5c92f
|
||||
@@ -1406,8 +1406,8 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P 2081d75767dc590b4c8457e5f8e5f18ba5f8eaa7 a0a08b8c0bbd4d71955261f6b7e997701ca68e18
|
||||
R 7ece1114510edab4a5d304cc0b06015c
|
||||
T +closed a0a08b8c0bbd4d71955261f6b7e997701ca68e18
|
||||
P 3d81dfe3bc5ca9588b7796769d9be7a182f38b1c 7850715406458a61cff9eba5ad915f61f6d99482
|
||||
R 53c67154b7bbcd33ca0c18e39c81df1f
|
||||
T +closed 7850715406458a61cff9eba5ad915f61f6d99482
|
||||
U drh
|
||||
Z 175aed9e7444f5a5f7c550af284b6e58
|
||||
Z f674907b91bbe0647e025dbc39f72b55
|
||||
|
||||
@@ -1 +1 @@
|
||||
3d81dfe3bc5ca9588b7796769d9be7a182f38b1c
|
||||
6a4cfc7ab62046eb718ce59eff6b632f239312ac
|
||||
33
src/btree.c
33
src/btree.c
@@ -1051,8 +1051,7 @@ static SQLITE_NOINLINE void btreeParseCellAdjustSizeForOverflow(
|
||||
}else{
|
||||
pInfo->nLocal = (u16)minLocal;
|
||||
}
|
||||
pInfo->iOverflow = (u16)(&pInfo->pPayload[pInfo->nLocal] - pCell);
|
||||
pInfo->nSize = pInfo->iOverflow + 4;
|
||||
pInfo->nSize = (u16)(&pInfo->pPayload[pInfo->nLocal] - pCell) + 4;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1084,7 +1083,6 @@ static void btreeParseCellPtrNoPayload(
|
||||
pInfo->nSize = 4 + getVarint(&pCell[4], (u64*)&pInfo->nKey);
|
||||
pInfo->nPayload = 0;
|
||||
pInfo->nLocal = 0;
|
||||
pInfo->iOverflow = 0;
|
||||
pInfo->pPayload = 0;
|
||||
return;
|
||||
}
|
||||
@@ -1154,7 +1152,6 @@ static void btreeParseCellPtr(
|
||||
pInfo->nSize = nPayload + (u16)(pIter - pCell);
|
||||
if( pInfo->nSize<4 ) pInfo->nSize = 4;
|
||||
pInfo->nLocal = (u16)nPayload;
|
||||
pInfo->iOverflow = 0;
|
||||
}else{
|
||||
btreeParseCellAdjustSizeForOverflow(pPage, pCell, pInfo);
|
||||
}
|
||||
@@ -1193,7 +1190,6 @@ static void btreeParseCellPtrIndex(
|
||||
pInfo->nSize = nPayload + (u16)(pIter - pCell);
|
||||
if( pInfo->nSize<4 ) pInfo->nSize = 4;
|
||||
pInfo->nLocal = (u16)nPayload;
|
||||
pInfo->iOverflow = 0;
|
||||
}else{
|
||||
btreeParseCellAdjustSizeForOverflow(pPage, pCell, pInfo);
|
||||
}
|
||||
@@ -1309,8 +1305,8 @@ static void ptrmapPutOvflPtr(MemPage *pPage, u8 *pCell, int *pRC){
|
||||
if( *pRC ) return;
|
||||
assert( pCell!=0 );
|
||||
pPage->xParseCell(pPage, pCell, &info);
|
||||
if( info.iOverflow ){
|
||||
Pgno ovfl = get4byte(&pCell[info.iOverflow]);
|
||||
if( info.nLocal<info.nPayload ){
|
||||
Pgno ovfl = get4byte(&pCell[info.nSize-4]);
|
||||
ptrmapPut(pPage->pBt, ovfl, PTRMAP_OVERFLOW1, pPage->pgno, pRC);
|
||||
}
|
||||
}
|
||||
@@ -3348,11 +3344,11 @@ static int modifyPagePointer(MemPage *pPage, Pgno iFrom, Pgno iTo, u8 eType){
|
||||
if( eType==PTRMAP_OVERFLOW1 ){
|
||||
CellInfo info;
|
||||
pPage->xParseCell(pPage, pCell, &info);
|
||||
if( info.iOverflow
|
||||
&& pCell+info.iOverflow+3<=pPage->aData+pPage->maskPage
|
||||
&& iFrom==get4byte(&pCell[info.iOverflow])
|
||||
if( info.nLocal<info.nPayload
|
||||
&& pCell+info.nSize-1<=pPage->aData+pPage->maskPage
|
||||
&& iFrom==get4byte(pCell+info.nSize-4)
|
||||
){
|
||||
put4byte(&pCell[info.iOverflow], iTo);
|
||||
put4byte(pCell+info.nSize-4, iTo);
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
@@ -5994,13 +5990,13 @@ static int clearCell(
|
||||
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
|
||||
pPage->xParseCell(pPage, pCell, &info);
|
||||
*pnSize = info.nSize;
|
||||
if( info.iOverflow==0 ){
|
||||
if( info.nLocal==info.nPayload ){
|
||||
return SQLITE_OK; /* No overflow pages. Return without doing anything */
|
||||
}
|
||||
if( pCell+info.iOverflow+3 > pPage->aData+pPage->maskPage ){
|
||||
if( pCell+info.nSize-1 > pPage->aData+pPage->maskPage ){
|
||||
return SQLITE_CORRUPT_BKPT; /* Cell extends past end of page */
|
||||
}
|
||||
ovflPgno = get4byte(&pCell[info.iOverflow]);
|
||||
ovflPgno = get4byte(pCell + info.nSize - 4);
|
||||
assert( pBt->usableSize > 4 );
|
||||
ovflPageSize = pBt->usableSize - 4;
|
||||
nOvfl = (info.nPayload - info.nLocal + ovflPageSize - 1)/ovflPageSize;
|
||||
@@ -6149,7 +6145,6 @@ static int fillInCell(
|
||||
assert( info.nKey==nKey );
|
||||
assert( *pnSize == info.nSize );
|
||||
assert( spaceLeft == info.nLocal );
|
||||
assert( pPrior == &pCell[info.iOverflow] );
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -6859,8 +6854,8 @@ static int ptrmapCheckPages(MemPage **apPage, int nPage){
|
||||
|
||||
z = findCell(pPage, j);
|
||||
pPage->xParseCell(pPage, z, &info);
|
||||
if( info.iOverflow ){
|
||||
Pgno ovfl = get4byte(&z[info.iOverflow]);
|
||||
if( info.nLocal<info.nPayload ){
|
||||
Pgno ovfl = get4byte(&z[info.nSize-4]);
|
||||
ptrmapGet(pBt, ovfl, &e, &n);
|
||||
assert( n==pPage->pgno && e==PTRMAP_OVERFLOW1 );
|
||||
}
|
||||
@@ -9166,9 +9161,9 @@ static int checkTreePage(
|
||||
if( info.nPayload>info.nLocal ){
|
||||
int nPage; /* Number of pages on the overflow chain */
|
||||
Pgno pgnoOvfl; /* First page of the overflow chain */
|
||||
assert( pc + info.iOverflow <= usableSize );
|
||||
assert( pc + info.nSize - 4 <= usableSize );
|
||||
nPage = (info.nPayload - info.nLocal + usableSize - 5)/(usableSize - 4);
|
||||
pgnoOvfl = get4byte(&pCell[info.iOverflow]);
|
||||
pgnoOvfl = get4byte(&pCell[info.nSize - 4]);
|
||||
#ifndef SQLITE_OMIT_AUTOVACUUM
|
||||
if( pBt->autoVacuum ){
|
||||
checkPtrmap(pCheck, pgnoOvfl, PTRMAP_OVERFLOW1, iPage);
|
||||
|
||||
@@ -470,7 +470,6 @@ struct CellInfo {
|
||||
u8 *pPayload; /* Pointer to the start of payload */
|
||||
u32 nPayload; /* Bytes of payload */
|
||||
u16 nLocal; /* Amount of payload held locally, not on overflow */
|
||||
u16 iOverflow; /* Offset to overflow page number. Zero if no overflow */
|
||||
u16 nSize; /* Size of the cell content on the main b-tree page */
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user