]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Minor performance optimization and size reduction to the accessPayload()
authordrh <drh@noemail.net>
Fri, 20 Jan 2017 20:43:14 +0000 (20:43 +0000)
committerdrh <drh@noemail.net>
Fri, 20 Jan 2017 20:43:14 +0000 (20:43 +0000)
routine in btree.c.

FossilOrigin-Name: 264e5c10d7144910b3223b64546567fa20e4bc65

manifest
manifest.uuid
src/btree.c

index 5ca437cb4955d84f555a71f9399b5a2b166bd850..9780aa29594afb61266a27c00424405c003781ea 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\stypo\sin\sthe\shelp\smessage\sfor\skvtest.
-D 2017-01-20T16:47:34.130
+C Minor\sperformance\soptimization\sand\ssize\sreduction\sto\sthe\saccessPayload()\nroutine\sin\sbtree.c.
+D 2017-01-20T20:43:14.971
 F Makefile.in 41bd4cad981487345c4a84081074bcdb876e4b2e
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc b8ca53350ae545e3562403d5da2a69cec79308da
@@ -333,7 +333,7 @@ F src/auth.c 930b376a9c56998557367e6f7f8aaeac82a2a792
 F src/backup.c faf17e60b43233c214aae6a8179d24503a61e83b
 F src/bitvec.c 17ea48eff8ba979f1f5b04cc484c7bb2be632f33
 F src/btmutex.c 0e9ce2d56159b89b9bc8e197e023ee11e39ff8ca
-F src/btree.c 69966fb2c574954cd3216f09407c9a02c52d3bd7
+F src/btree.c e6b8f39d7dd1ad65f1747956de36f2595172a23d
 F src/btree.h e6d352808956ec163a17f832193a3e198b3fb0ac
 F src/btreeInt.h 10c4b77c2fb399580babbcc7cf652ac10dba796e
 F src/build.c 9e799f1edd910dfa8a0bc29bd390d35d310596af
@@ -1547,7 +1547,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 90291327fc127671d9847a4a2ce1ed47a408cfc6
-R a902108b38beec2205eaeba771709e26
-U dan
-Z 09bc78c7c0c7ebb44e280cf03b306ae8
+P 8971d98f25a4f5fb060db8ed6a4b06f083122a50
+R 6803846831f043d39b9c85f99ff10309
+U drh
+Z 62cd4db9c45f8ac36491823fd1143808
index 4b97c1dc13c082dcf34937e197da38f6d94ce3c0..6d1f724a7b8807e2dec6e08b6bcd1b95948f5d90 100644 (file)
@@ -1 +1 @@
-8971d98f25a4f5fb060db8ed6a4b06f083122a50
\ No newline at end of file
+264e5c10d7144910b3223b64546567fa20e4bc65
\ No newline at end of file
index 7b568676468f6f1a9a5bc2e11ddf3330b24a71be..fb056559127906002d3911b0067277aeee0ec4be 100644 (file)
@@ -4523,16 +4523,14 @@ static int accessPayload(
             pCur->aOverflow, nOvfl*2*sizeof(Pgno)
         );
         if( aNew==0 ){
-          rc = SQLITE_NOMEM_BKPT;
+          return SQLITE_NOMEM_BKPT;
         }else{
           pCur->nOvflAlloc = nOvfl*2;
           pCur->aOverflow = aNew;
         }
       }
-      if( rc==SQLITE_OK ){
-        memset(pCur->aOverflow, 0, nOvfl*sizeof(Pgno));
-        pCur->curFlags |= BTCF_ValidOvfl;
-      }
+      memset(pCur->aOverflow, 0, nOvfl*sizeof(Pgno));
+      pCur->curFlags |= BTCF_ValidOvfl;
     }
 
     /* If the overflow page-list cache has been allocated and the
@@ -4547,8 +4545,8 @@ static int accessPayload(
       offset = (offset%ovflSize);
     }
 
-    for( ; rc==SQLITE_OK && amt>0 && nextPage; iIdx++){
-
+    assert( rc==SQLITE_OK && amt>0 );
+    while( nextPage ){
       /* If required, populate the overflow page-list cache. */
       if( (pCur->curFlags & BTCF_ValidOvfl)!=0 ){
         assert( pCur->aOverflow[iIdx]==0
@@ -4637,6 +4635,9 @@ static int accessPayload(
         amt -= a;
         pBuf += a;
       }
+      if( amt==0 ) break;
+      if( rc ) break;
+      iIdx++;
     }
   }