From cdf360a0d5c3edfb49a44a7de9b39052f9562d2e Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 27 Jan 2017 01:13:49 +0000 Subject: [PATCH] Performance optimization in accessPayload(). FossilOrigin-Name: ebb1fd98d4e448aa6d8f1e5be7ddc5bedb3db95b --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/btree.c | 20 ++++++++++---------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/manifest b/manifest index 0ab648517f..f9f99a3dde 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Simplify\sthe\saccessPayload()\sroutine\sso\sthat\sit\salways\spopulates\sthe\soverflow\npage\scache.\s\sIn\sthe\sone\scase\swhere\spopulating\sthe\spage\scache\scan\slead\sto\s\nproblems,\ssimply\sinvalidate\sthe\scache\sas\ssoon\sas\saccessPayload()\sreturns.\s\s\nThis\ssimplification\sreduces\scode\ssize\sand\shelps\saccessPayload()\sto\srun\sa\s\nlittle\sfaster.\s\sThis\sbacks\sout\sthe\seOp==2\smode\sof\saccessPayload()\sadded\sby\s\ncheck-in\s[da59198505]. -D 2017-01-27T00:31:59.289 +C Performance\soptimization\sin\saccessPayload(). +D 2017-01-27T01:13:49.702 F Makefile.in 5f415e7867296d678fed2e6779aea10c1318b4bc 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 d42f290214e6615020b61866fe0747f02614964e +F src/btree.c 1329274c46bc554daf7acde825f72f76f66647ec 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 293bf3ed7e40745349c83b202b27ed1b48517e1a -R ec063431f8eb3294f488a586b69214cb +P 68e7a8c6765649195ef1ad9407d87d44a307b462 +R cab1deb289447016960f1fadc0c9e121 U drh -Z 81eb07f579988e3e7128daaaea36d064 +Z 955f6c694c099beee31ec142603efb52 diff --git a/manifest.uuid b/manifest.uuid index 6d62a1cc6d..a23f86a1ed 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -68e7a8c6765649195ef1ad9407d87d44a307b462 \ No newline at end of file +ebb1fd98d4e448aa6d8f1e5be7ddc5bedb3db95b \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 2575c774cf..54664043d4 100644 --- a/src/btree.c +++ b/src/btree.c @@ -4525,16 +4525,16 @@ static int accessPayload( } memset(pCur->aOverflow, 0, nOvfl*sizeof(Pgno)); pCur->curFlags |= BTCF_ValidOvfl; - } - - /* If the overflow page-list cache has been allocated and the - ** entry for the first required overflow page is valid, skip - ** directly to it. - */ - if( pCur->aOverflow[offset/ovflSize] ){ - iIdx = (offset/ovflSize); - nextPage = pCur->aOverflow[iIdx]; - offset = (offset%ovflSize); + }else{ + /* If the overflow page-list cache has been allocated and the + ** entry for the first required overflow page is valid, skip + ** directly to it. + */ + if( pCur->aOverflow[offset/ovflSize] ){ + iIdx = (offset/ovflSize); + nextPage = pCur->aOverflow[iIdx]; + offset = (offset%ovflSize); + } } assert( rc==SQLITE_OK && amt>0 );