1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-10 01:02:56 +03:00

Add the BtCursor.curIntKey field and use it for a small size reduction and

performance boost.

FossilOrigin-Name: 4a17df139ac41e29c9a2e58afbd1238a5e94bd36
This commit is contained in:
drh
2015-06-27 22:49:10 +00:00
parent 15a0021b3e
commit 408efc0664
4 changed files with 17 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
C Enhancements\sto\sthe\sprevious\scheck-in\sto\smake\sit\sa\slittle\ssmaller\sand\sfaster. C Add\sthe\sBtCursor.curIntKey\sfield\sand\suse\sit\sfor\sa\ssmall\ssize\sreduction\sand\nperformance\sboost.
D 2015-06-27T20:55:00.648 D 2015-06-27T22:49:10.437
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 285a0a234ed7610d431d91671c136098c2bd86a9 F Makefile.in 285a0a234ed7610d431d91671c136098c2bd86a9
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -269,9 +269,9 @@ 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 a6b0259834076783c7a22a0963bd91abcf27ef0f F src/btree.c 124fb2cf3712a32e3cfec4441dac82218d267419
F src/btree.h 969adc948e89e449220ff0ff724c94bb2a52e9f1 F src/btree.h 969adc948e89e449220ff0ff724c94bb2a52e9f1
F src/btreeInt.h 30f611b87ff873f47a28ce0bf66dd778c3274d9a F src/btreeInt.h 8ca7124af9ee2ce27747a4e5500c27a254dea8eb
F src/build.c b3f15255d5b16e42dafeaa638fd4f8a47c94ed70 F src/build.c b3f15255d5b16e42dafeaa638fd4f8a47c94ed70
F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0 F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0
F src/complete.c a5cf5b4b56390cfb7b8636e8f7ddef90258dd575 F src/complete.c a5cf5b4b56390cfb7b8636e8f7ddef90258dd575
@@ -1364,7 +1364,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 1956a4ce8eca650d98a7f68fd2d82eb8a3d6069f P 291d9e0c328a7bd0f255b0b7e819ca2c909701a3
R 72a9a3c8bf73162e5f9bead1ad9abb3a R 2c201a19b31719b4111966366152c8e1
U drh U drh
Z d1566e69624f823fa39952a25235aa04 Z 3864de7c8c7143c5030e74933e17298b

View File

@@ -1 +1 @@
291d9e0c328a7bd0f255b0b7e819ca2c909701a3 4a17df139ac41e29c9a2e58afbd1238a5e94bd36

View File

@@ -1955,7 +1955,7 @@ static int getAndInitPage(
/* If obtaining a child page for a cursor, we must verify that the page is /* If obtaining a child page for a cursor, we must verify that the page is
** compatible with the root page. */ ** compatible with the root page. */
if( pCur if( pCur
&& ((*ppPage)->nCell<1 || (*ppPage)->intKey!=pCur->apPage[0]->intKey) && ((*ppPage)->nCell<1 || (*ppPage)->intKey!=pCur->curIntKey)
){ ){
rc = SQLITE_CORRUPT_BKPT; rc = SQLITE_CORRUPT_BKPT;
releasePage(*ppPage); releasePage(*ppPage);
@@ -4784,6 +4784,7 @@ static int moveToRoot(BtCursor *pCur){
return rc; return rc;
} }
pCur->iPage = 0; pCur->iPage = 0;
pCur->curIntKey = pCur->apPage[0]->intKey;
} }
pRoot = pCur->apPage[0]; pRoot = pCur->apPage[0];
assert( pRoot->pgno==pCur->pgnoRoot ); assert( pRoot->pgno==pCur->pgnoRoot );

View File

@@ -508,7 +508,6 @@ struct BtCursor {
Btree *pBtree; /* The Btree to which this cursor belongs */ Btree *pBtree; /* The Btree to which this cursor belongs */
BtShared *pBt; /* The BtShared this cursor points to */ BtShared *pBt; /* The BtShared this cursor points to */
BtCursor *pNext, *pPrev; /* Forms a linked list of all cursors */ BtCursor *pNext, *pPrev; /* Forms a linked list of all cursors */
struct KeyInfo *pKeyInfo; /* Argument passed to comparison function */
Pgno *aOverflow; /* Cache of overflow page locations */ Pgno *aOverflow; /* Cache of overflow page locations */
CellInfo info; /* A parse of the cell we are pointing at */ CellInfo info; /* A parse of the cell we are pointing at */
i64 nKey; /* Size of pKey, or last integer key */ i64 nKey; /* Size of pKey, or last integer key */
@@ -520,8 +519,13 @@ struct BtCursor {
u8 curFlags; /* zero or more BTCF_* flags defined below */ u8 curFlags; /* zero or more BTCF_* flags defined below */
u8 curPagerFlags; /* Flags to send to sqlite3PagerAcquire() */ u8 curPagerFlags; /* Flags to send to sqlite3PagerAcquire() */
u8 eState; /* One of the CURSOR_XXX constants (see below) */ u8 eState; /* One of the CURSOR_XXX constants (see below) */
u8 hints; /* As configured by CursorSetHints() */ u8 hints; /* As configured by CursorSetHints() */
i16 iPage; /* Index of current page in apPage */ /* All fields above are zeroed when the cursor is allocated. See
** sqlite3BtreeCursorZero(). Fields that follow must be manually
** initialized. */
i8 iPage; /* Index of current page in apPage */
u8 curIntKey; /* Value of apPage[0]->intKey */
struct KeyInfo *pKeyInfo; /* Argument passed to comparison function */
u16 aiIdx[BTCURSOR_MAX_DEPTH]; /* Current index in apPage[i] */ u16 aiIdx[BTCURSOR_MAX_DEPTH]; /* Current index in apPage[i] */
MemPage *apPage[BTCURSOR_MAX_DEPTH]; /* Pages from root to current page */ MemPage *apPage[BTCURSOR_MAX_DEPTH]; /* Pages from root to current page */
}; };