-C Simplify\sa\sconditional\sexpression\sin\sbtree.c.\s(CVS\s6565)
-D 2009-04-29T06:27:57
+C Add\sa\sversion\sof\scellSizePtr()\sthat\sis\sfaster\sthan\susing\ssqlite3BtreeParseCellPtr().\sThis\sspeeds\sup\sbalance_nonroot().\s(CVS\s6566)
+D 2009-04-29T11:31:47
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/backup.c 0082d0e5a63f04e88faee0dff0a7d63d3e92a78d
F src/bitvec.c ef370407e03440b0852d05024fb016b14a471d3d
F src/btmutex.c 9b899c0d8df3bd68f527b0afe03088321b696d3c
-F src/btree.c 3dffdafe21bf727f0e3409436ac65e3d7b319673
+F src/btree.c d3e38cf751251096c2d2017ff9f2375e29bf0f99
F src/btree.h 99fcc7e8c4a1e35afe271bcb38de1a698dfc904e
F src/btreeInt.h df64030d632f8c8ac217ed52e8b6b3eacacb33a5
F src/build.c dca0ad77c88cb00f6a11cc080a4f3285672cfa37
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P e855654283a23d903fd531162655a8c4fa01775b
-R 63c07503296c76f396fee3ac325064a0
+P fc3a5ac2353142082fe14d47f9c2b662407ea3f7
+R 7f4b713c43e75500014d39ff57631373
U danielk1977
-Z 5dbb9b5bf3757053f2c4aad47a67a72e
+Z 7a846e8596d6c8f108ba0f337c171b19
** May you share freely, never taking more than you give.
**
*************************************************************************
-** $Id: btree.c,v 1.597 2009/04/29 06:27:57 danielk1977 Exp $
+** $Id: btree.c,v 1.598 2009/04/29 11:31:47 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
** data header and the local payload, but not any overflow page or
** the space used by the cell pointer.
*/
+static u16 cellSizePtr(MemPage *pPage, u8 *pCell){
+ u8 *pIter = &pCell[pPage->childPtrSize];
+ u32 nSize;
+
+#ifdef SQLITE_DEBUG
+ /* The value returned by this function should always be the same as
+ ** the (CellInfo.nSize) value found by doing a full parse of the
+ ** cell. If SQLITE_DEBUG is defined, an assert() at the bottom of
+ ** this function verifies that this invariant is not violated. */
+ CellInfo debuginfo;
+ sqlite3BtreeParseCellPtr(pPage, pCell, &debuginfo);
+#endif
+
+ if( pPage->intKey ){
+ u8 *pEnd;
+ if( pPage->hasData ){
+ pIter += getVarint32(pIter, nSize);
+ }else{
+ nSize = 0;
+ }
+
+ /* pIter now points at the 64-bit integer key value, a variable length
+ ** integer. The following block moves pIter to point at the first byte
+ ** past the end of the key value. */
+ pEnd = &pIter[9];
+ while( (*pIter++)&0x80 && pIter<pEnd );
+ }else{
+ pIter += getVarint32(pIter, nSize);
+ }
+
+ if( nSize>pPage->maxLocal ){
+ int minLocal = pPage->minLocal;
+ nSize = minLocal + (nSize - minLocal) % (pPage->pBt->usableSize - 4);
+ if( nSize>pPage->maxLocal ){
+ nSize = minLocal;
+ }
+ nSize += 4;
+ }
+ nSize += (pIter - pCell);
+
+ /* The minimum size of any cell is 4 bytes. */
+ if( nSize<4 ){
+ nSize = 4;
+ }
+
+ assert( nSize==debuginfo.nSize );
+ return nSize;
+}
#ifndef NDEBUG
static u16 cellSize(MemPage *pPage, int iCell){
- CellInfo info;
- sqlite3BtreeParseCell(pPage, iCell, &info);
- return info.nSize;
+ return cellSizePtr(pPage, findCell(pPage, iCell));
}
#endif
-static u16 cellSizePtr(MemPage *pPage, u8 *pCell){
- CellInfo info;
- sqlite3BtreeParseCellPtr(pPage, pCell, &info);
- return info.nSize;
-}
#ifndef SQLITE_OMIT_AUTOVACUUM
/*