]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Size reduction and substantial performance increase for cellSizePtr().
authordrh <drh@noemail.net>
Mon, 22 Sep 2014 19:51:35 +0000 (19:51 +0000)
committerdrh <drh@noemail.net>
Mon, 22 Sep 2014 19:51:35 +0000 (19:51 +0000)
FossilOrigin-Name: bc8bbf3207288d160287519c3b7123997996b440

manifest
manifest.uuid
src/btree.c

index 926eedc817f36ba19bbd4747f72cbc97ac9b9fb9..d9984e2d8c909b7123242b3d1e21555d612bea81 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Tune\sthe\squery\splanner\sto\sbe\smore\saggressive\sabout\susing\sautomatic\sindexes\non\sviews\sand\ssubqueries\sfor\swhich\sthere\sis\snot\sopportunity\sto\sdeclare\sa\npersistent\sschema\sindex.
-D 2014-09-22T14:30:51.911
+C Size\sreduction\sand\ssubstantial\sperformance\sincrease\sfor\scellSizePtr().
+D 2014-09-22T19:51:35.432
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -172,7 +172,7 @@ F src/auth.c d8abcde53426275dab6243b441256fcd8ccbebb2
 F src/backup.c a31809c65623cc41849b94d368917f8bb66e6a7e
 F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb
 F src/btmutex.c 49ca66250c7dfa844a4d4cb8272b87420d27d3a5
-F src/btree.c 6aa61c0e3d20d1d1acc8fb33d8f0ebd675305d3c
+F src/btree.c 86cc6efed093b80360489acac4d2daf064a1ad58
 F src/btree.h a79aa6a71e7f1055f01052b7f821bd1c2dce95c8
 F src/btreeInt.h e0ecb5dba292722039a7540beb3fc448103273cc
 F src/build.c 8dbca25988045fbf2a33c9631c42706fa6449e60
@@ -1199,7 +1199,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 10a6e510497b471d67ac3dfb19ff256a7d18adf4
-R f6ce79b0bd0352edf4a2c65db2a400a7
+P 41de1643bfc9ae25e20790d707e2789b665baa2b
+R 20814d8e71474a3ca52334b7cc5e7228
 U drh
-Z b1246ec5b6570c51d45a58350d46840c
+Z 93d80b8ba28615b25f3f6e1541988990
index a03afa027d7dcf4330c4e0bef19c7efecfa6e1b7..63137ebd347b33ab31cdb171171de6fa8d4a7e81 100644 (file)
@@ -1 +1 @@
-41de1643bfc9ae25e20790d707e2789b665baa2b
\ No newline at end of file
+bc8bbf3207288d160287519c3b7123997996b440
\ No newline at end of file
index 522e945ac2a7f66fb2b46c3bf66e1446a060598c..46eb5be3030c22c9810707cc515b3e4bc40eeaa2 100644 (file)
@@ -1057,6 +1057,7 @@ static void btreeParseCell(
 */
 static u16 cellSizePtr(MemPage *pPage, u8 *pCell){
   u8 *pIter = &pCell[pPage->childPtrSize];
+  u8 *pEnd;
   u32 nSize;
 
 #ifdef SQLITE_DEBUG
@@ -1068,21 +1069,25 @@ static u16 cellSizePtr(MemPage *pPage, u8 *pCell){
   btreeParseCellPtr(pPage, pCell, &debuginfo);
 #endif
 
-  if( pPage->intKey ){
-    u8 *pEnd;
-    if( pPage->hasData ){
-      pIter += getVarint32(pIter, nSize);
-    }else{
-      nSize = 0;
+  if( pPage->intKey==0 || pPage->hasData ){
+    nSize = *pIter;
+    if( nSize>=0x80 ){
+      pEnd = &pIter[9];
+      nSize &= 0x7f;
+      do{
+        nSize = (nSize<<7) | (*++pIter & 0x7f);
+      }while( *(pIter)>=0x80 && pIter<&pCell[6] );
     }
-
+    pIter++;
+  }else{
+    nSize = 0;
+  }
+  if( pPage->intKey ){
     /* 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);
   }
 
   testcase( nSize==pPage->maxLocal );
@@ -1104,7 +1109,7 @@ static u16 cellSizePtr(MemPage *pPage, u8 *pCell){
     nSize = 4;
   }
 
-  assert( nSize==debuginfo.nSize );
+  assert( nSize==debuginfo.nSize || CORRUPT_DB );
   return (u16)nSize;
 }