]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add the BtCursor.curIntKey field and use it for a small size reduction and
authordrh <drh@noemail.net>
Sat, 27 Jun 2015 22:49:10 +0000 (22:49 +0000)
committerdrh <drh@noemail.net>
Sat, 27 Jun 2015 22:49:10 +0000 (22:49 +0000)
performance boost.

FossilOrigin-Name: 4a17df139ac41e29c9a2e58afbd1238a5e94bd36

manifest
manifest.uuid
src/btree.c
src/btreeInt.h

index f672f228e4865424a0c16b9768e75f7e22cb75cf..24c66a974b4471c7412fec0a6ff672a9b821d97f 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Enhancements\sto\sthe\sprevious\scheck-in\sto\smake\sit\sa\slittle\ssmaller\sand\sfaster.
-D 2015-06-27T20:55:00.648
+C Add\sthe\sBtCursor.curIntKey\sfield\sand\suse\sit\sfor\sa\ssmall\ssize\sreduction\sand\nperformance\sboost.
+D 2015-06-27T22:49:10.437
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 285a0a234ed7610d431d91671c136098c2bd86a9
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -269,9 +269,9 @@ F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240
 F src/backup.c ff743689c4d6c5cb55ad42ed9d174b2b3e71f1e3
 F src/bitvec.c 5eb7958c3bf65210211cbcfc44eff86d0ded7c9d
 F src/btmutex.c 45a968cc85afed9b5e6cf55bf1f42f8d18107f79
-F src/btree.c a6b0259834076783c7a22a0963bd91abcf27ef0f
+F src/btree.c 124fb2cf3712a32e3cfec4441dac82218d267419
 F src/btree.h 969adc948e89e449220ff0ff724c94bb2a52e9f1
-F src/btreeInt.h 30f611b87ff873f47a28ce0bf66dd778c3274d9a
+F src/btreeInt.h 8ca7124af9ee2ce27747a4e5500c27a254dea8eb
 F src/build.c b3f15255d5b16e42dafeaa638fd4f8a47c94ed70
 F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0
 F src/complete.c a5cf5b4b56390cfb7b8636e8f7ddef90258dd575
@@ -1364,7 +1364,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 1956a4ce8eca650d98a7f68fd2d82eb8a3d6069f
-R 72a9a3c8bf73162e5f9bead1ad9abb3a
+P 291d9e0c328a7bd0f255b0b7e819ca2c909701a3
+R 2c201a19b31719b4111966366152c8e1
 U drh
-Z d1566e69624f823fa39952a25235aa04
+Z 3864de7c8c7143c5030e74933e17298b
index dd783bb52c7e4747050e87ec9daea82fb2b05a01..7646601c90b9a6f850eefc337ca9a9b13f8175fc 100644 (file)
@@ -1 +1 @@
-291d9e0c328a7bd0f255b0b7e819ca2c909701a3
\ No newline at end of file
+4a17df139ac41e29c9a2e58afbd1238a5e94bd36
\ No newline at end of file
index 80a8ace51052eddd34bf0e03d3acb5ea158b94fc..f9dbfa14add4d33ba82841f7e34dd6fd61a6e7cc 100644 (file)
@@ -1955,7 +1955,7 @@ static int getAndInitPage(
   /* If obtaining a child page for a cursor, we must verify that the page is
   ** compatible with the root page. */
   if( pCur
-   && ((*ppPage)->nCell<1 || (*ppPage)->intKey!=pCur->apPage[0]->intKey)
+   && ((*ppPage)->nCell<1 || (*ppPage)->intKey!=pCur->curIntKey)
   ){
     rc = SQLITE_CORRUPT_BKPT;
     releasePage(*ppPage);
@@ -4784,6 +4784,7 @@ static int moveToRoot(BtCursor *pCur){
       return rc;
     }
     pCur->iPage = 0;
+    pCur->curIntKey = pCur->apPage[0]->intKey;
   }
   pRoot = pCur->apPage[0];
   assert( pRoot->pgno==pCur->pgnoRoot );
index fa8d2c1fb46c442db3c80de8360903e042c4f068..70aa937c7d8186a5b0204e55df95d9eb70a73bee 100644 (file)
@@ -508,7 +508,6 @@ struct BtCursor {
   Btree *pBtree;            /* The Btree to which this cursor belongs */
   BtShared *pBt;            /* The BtShared this cursor points to */
   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 */
   CellInfo info;            /* A parse of the cell we are pointing at */
   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 curPagerFlags;         /* Flags to send to sqlite3PagerAcquire() */
   u8 eState;                /* One of the CURSOR_XXX constants (see below) */
-  u8 hints;                             /* As configured by CursorSetHints() */
-  i16 iPage;                            /* Index of current page in apPage */
+  u8 hints;                 /* As configured by CursorSetHints() */
+  /* 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] */
   MemPage *apPage[BTCURSOR_MAX_DEPTH];  /* Pages from root to current page */
 };