From: drh Date: Fri, 29 Apr 2016 02:55:05 +0000 (+0000) Subject: Some optimization comments added to vdbe.c. No functional changes to code. X-Git-Tag: version-3.13.0~56 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a3fa140fb46e74cb86cd1b44905842efd03c9c5e;p=thirdparty%2Fsqlite.git Some optimization comments added to vdbe.c. No functional changes to code. FossilOrigin-Name: e7c22e3bffce63f3b47fa3683be8c00c42b2a7d3 --- diff --git a/manifest b/manifest index 4d312042a1..da4cac8196 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Further\ssimplifications\sand\simproved\scommentting\son\sthe\srowset.c\smodule,\nincluding\sseveral\soptimization\scomments. -D 2016-04-28T22:29:31.056 +C Some\soptimization\scomments\sadded\sto\svdbe.c.\s\sNo\sfunctional\schanges\sto\scode. +D 2016-04-29T02:55:05.603 F Makefile.in 9e816d0323e418fbc0f8b2c05fc14e0b3763d9e8 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 71b8b16cf9393f68e2e2035486ca104872558836 @@ -443,7 +443,7 @@ F src/update.c 3e67ab3c0814635f355fb1f8ab010a2b9e016e7d F src/utf.c 699001c79f28e48e9bcdf8a463da029ea660540c F src/util.c 810ec3f22e2d1b62e66c30fe3621ebdedd23584d F src/vacuum.c feb1eabb20987983d9350cad98299b21fa811f52 -F src/vdbe.c d3843a66d74a7696477ee5141e5eb9a7e5e2401c +F src/vdbe.c 08fbea00a7f7f723973093c5f5bf7c40c025e2b3 F src/vdbe.h 5591b5add447096e31288b5a0a78ec5d7b5c5170 F src/vdbeInt.h ddb157974436d87652de7dc641f7191496d9a8cd F src/vdbeapi.c ba85b78fe08dc4a9ce747e62c89a2b4a4547e74c @@ -1484,7 +1484,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 8cdbe89ac6c22d632f677eb293111b3dbae7d6c1 -R 9629e5ecfb28b4deca7492eeb801c3d3 +P 9f15a520deb9f1d4ecaa3bfff82bd57ef122aadb +R 9e8b60c02f680bebef2b9615706e75d6 U drh -Z f98c64d26c6e12bfaaf00c7f14039634 +Z f25847a4d8f7c8c164def037ab0b4e49 diff --git a/manifest.uuid b/manifest.uuid index fd604e04b3..74550e35d8 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9f15a520deb9f1d4ecaa3bfff82bd57ef122aadb \ No newline at end of file +e7c22e3bffce63f3b47fa3683be8c00c42b2a7d3 \ No newline at end of file diff --git a/src/vdbe.c b/src/vdbe.c index 244a4ad063..5fba14a5c3 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -215,7 +215,7 @@ static VdbeCursor *allocateCursor( (eCurType==CURTYPE_BTREE?sqlite3BtreeCursorSize():0); assert( iCur>=0 && iCurnCursor ); - if( p->apCsr[iCur] ){ + if( p->apCsr[iCur] ){ /*OPTIMIZATION-IF-FALSE*/ sqlite3VdbeFreeCursor(p, p->apCsr[iCur]); p->apCsr[iCur] = 0; } @@ -292,7 +292,7 @@ static void applyAffinity( if( affinity>=SQLITE_AFF_NUMERIC ){ assert( affinity==SQLITE_AFF_INTEGER || affinity==SQLITE_AFF_REAL || affinity==SQLITE_AFF_NUMERIC ); - if( (pRec->flags & MEM_Int)==0 ){ + if( (pRec->flags & MEM_Int)==0 ){ /*OPTIMIZATION-IF-FALSE*/ if( (pRec->flags & MEM_Real)==0 ){ if( pRec->flags & MEM_Str ) applyNumericAffinity(pRec,1); }else{ @@ -302,10 +302,13 @@ static void applyAffinity( }else if( affinity==SQLITE_AFF_TEXT ){ /* Only attempt the conversion to TEXT if there is an integer or real ** representation (blob and NULL do not get converted) but no string - ** representation. - */ - if( 0==(pRec->flags&MEM_Str) && (pRec->flags&(MEM_Real|MEM_Int)) ){ - sqlite3VdbeMemStringify(pRec, enc, 1); + ** representation. It would be harmless to repeat the conversion if + ** there is already a string rep, but it is pointless to waste those + ** CPU cycles. */ + if( 0==(pRec->flags&MEM_Str) ){ /*OPTIMIZATION-IF-FALSE*/ + if( (pRec->flags&(MEM_Real|MEM_Int)) ){ + sqlite3VdbeMemStringify(pRec, enc, 1); + } } pRec->flags &= ~(MEM_Real|MEM_Int); } @@ -542,7 +545,7 @@ static Mem *out2Prerelease(Vdbe *p, VdbeOp *pOp){ assert( pOp->p2<=(p->nMem+1 - p->nCursor) ); pOut = &p->aMem[pOp->p2]; memAboutToChange(p, pOut); - if( VdbeMemDynamic(pOut) ){ + if( VdbeMemDynamic(pOut) ){ /*OPTIMIZATION-IF-FALSE*/ return out2PrereleaseWithClear(pOut); }else{ pOut->flags = MEM_Int;