]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Optimization to sqltie3BtreeParseCellPtr. 0.3% performance increase. (CVS 5432)
authordrh <drh@noemail.net>
Fri, 18 Jul 2008 00:57:33 +0000 (00:57 +0000)
committerdrh <drh@noemail.net>
Fri, 18 Jul 2008 00:57:33 +0000 (00:57 +0000)
FossilOrigin-Name: 77e099ad7de84fe07dfeb4c045c769653dd13b93

manifest
manifest.uuid
src/btree.c

index 1118681bf8b92bb22aaa65905dab9799d4883910..1ac4c8a3b23f3e276efa091270665502087783ef 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Simplify\sthe\sb-tree\slogic\sby\staking\sadvantage\sof\sthe\sfact\sthat\sall\sb-trees\nare\seither\sintkey+leafdata\sor\szerodata.\s(CVS\s5431)
-D 2008-07-17T18:39:58
+C Optimization\sto\ssqltie3BtreeParseCellPtr.\s\s0.3%\sperformance\sincrease.\s(CVS\s5432)
+D 2008-07-18T00:57:33
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in a03f7cb4f7ad50bc53a788c6c544430e81f95de4
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -96,7 +96,7 @@ F src/attach.c b18ba42c77f7d3941f5d23d2ca20fa1d841a4e91
 F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
 F src/bitvec.c 95c86bd18d8fedf0533f5af196192546e10a7e7d
 F src/btmutex.c 709cad2cdca0afd013f0f612363810e53f59ec53
-F src/btree.c c618d62fb41642216f8fc5be403c36f32e1b25d6
+F src/btree.c 5299a702966d3c32618340cae49cebafc5e93870
 F src/btree.h 03256ed7ee42b5ecacbe887070b0f8249e7d069d
 F src/btreeInt.h 2aa6dc53b1801bb22815a5be22e03be121f3bd8f
 F src/build.c bac7233d984be3805aaa41cf500f7ee12dc97249
@@ -608,7 +608,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 26a203d894edd0091ac60862956e42d22167011e
-R 0aa24510df7c6bac75839ea22cde6884
+P 29d3bfd7c9a68078385354394052612bf812859b
+R 52c1e00d28149edaa06e0b96ba148399
 U drh
-Z 2661cde038f2c435549bd085c583b89a
+Z ba442f29937e797f8880a62ff02e96e8
index 29ed7477cea7bf58219b5c18eac62f81d728f9c9..48a14c1e9694ea0af35e8b6831d2e60ad1309d14 100644 (file)
@@ -1 +1 @@
-29d3bfd7c9a68078385354394052612bf812859b
\ No newline at end of file
+77e099ad7de84fe07dfeb4c045c769653dd13b93
\ No newline at end of file
index a9bd5f0d894422b713db23d62c78f6a42118baf0..8cf6a1e81a5756aec43b2114fe935da4a6e15522 100644 (file)
@@ -9,7 +9,7 @@
 **    May you share freely, never taking more than you give.
 **
 *************************************************************************
-** $Id: btree.c,v 1.484 2008/07/17 18:39:58 drh Exp $
+** $Id: btree.c,v 1.485 2008/07/18 00:57:33 drh Exp $
 **
 ** This file implements a external (disk-based) database using BTrees.
 ** See the header comment on "btreeInt.h" for additional information.
@@ -564,31 +564,30 @@ void sqlite3BtreeParseCellPtr(
   assert( pPage->leaf==0 || pPage->leaf==1 );
   n = pPage->childPtrSize;
   assert( n==4-4*pPage->leaf );
-  if( pPage->hasData ){
-    n += getVarint32(&pCell[n], nPayload);
-  }else{
-    nPayload = 0;
-  }
-  pInfo->nData = nPayload;
   if( pPage->intKey ){
-    n += getVarint(&pCell[n], (u64 *)&pInfo->nKey);
+    if( pPage->hasData ){
+      n += getVarint32(&pCell[n], nPayload);
+    }else{
+      nPayload = 0;
+    }
+    n += getVarint(&pCell[n], (u64*)&pInfo->nKey);
+    pInfo->nData = nPayload;
   }else{
-    u32 x;
-    n += getVarint32(&pCell[n], x);
-    pInfo->nKey = x;
-    nPayload += x;
+    pInfo->nData = 0;
+    n += getVarint32(&pCell[n], nPayload);
+    pInfo->nKey = nPayload;
   }
   pInfo->nPayload = nPayload;
   pInfo->nHeader = n;
-  if( nPayload<=pPage->maxLocal ){
+  if( likely(nPayload<=pPage->maxLocal) ){
     /* This is the (easy) common case where the entire payload fits
     ** on the local page.  No overflow is required.
     */
     int nSize;          /* Total size of cell content in bytes */
+    nSize = nPayload + n;
     pInfo->nLocal = nPayload;
     pInfo->iOverflow = 0;
-    nSize = nPayload + n;
-    if( nSize<4 ){
+    if( (nSize & ~3)==0 ){
       nSize = 4;        /* Minimum cell size is 4 */
     }
     pInfo->nSize = nSize;