From: drh Date: Sat, 26 Jul 2014 16:47:23 +0000 (+0000) Subject: Avoid unnecessary no-op calls to applyNumericAffinity() for a small X-Git-Tag: version-3.8.6~57 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=975b4c6e8bc70bfb0d8f29107d393f692d162a69;p=thirdparty%2Fsqlite.git Avoid unnecessary no-op calls to applyNumericAffinity() for a small performance improvement. FossilOrigin-Name: 413d7287977702fa651c0140bd5cf29021fe3e79 --- diff --git a/manifest b/manifest index 1097f4e5de..480568c8f0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Try\sto\sfix\sharmless\scompiler\swarnings\sreported\sby\sFortify. -D 2014-07-25T21:35:39.767 +C Avoid\sunnecessary\sno-op\scalls\sto\sapplyNumericAffinity()\sfor\sa\ssmall\nperformance\simprovement. +D 2014-07-26T16:47:23.387 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5eb79e334a5de69c87740edd56af6527dd219308 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -283,7 +283,7 @@ F src/update.c 01564b3c430f6c7b0a35afaf7aba7987206fa3a5 F src/utf.c a0314e637768a030e6e84a957d0c4f6ba910cc05 F src/util.c 3076bdd51cdbf60a6e2e57fada745be37133c73e F src/vacuum.c 3728d74919d4fb1356f9e9a13e27773db60b7179 -F src/vdbe.c b7af861342a215c7f27d3f20d92fe0b70f54fb3e +F src/vdbe.c 145f909c1c7b16b0899bcab8b241b811e4af9534 F src/vdbe.h c63fad052c9e7388d551e556e119c0bcf6bebdf8 F src/vdbeInt.h f5513f2b5ac1e2c5128996c7ea23add256a301df F src/vdbeapi.c 24e40422382beb774daab11fe9fe9d37e8a04949 @@ -1184,7 +1184,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 2d32e4876e0b162730f81e5c2658be12d64a9a99 -R 863e6abd5a7272b515477418397f96e6 +P e0fa6fdc14ac5458f9200cbae124f8025ea534ea +R 497e2677c499db4d4a797e5c1acd577b U drh -Z f462357bfa110cd51b2e07287181f811 +Z ee817a86e8cc0ab5547d2241830d36e2 diff --git a/manifest.uuid b/manifest.uuid index 908cd7712f..06b44f1d10 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e0fa6fdc14ac5458f9200cbae124f8025ea534ea \ No newline at end of file +413d7287977702fa651c0140bd5cf29021fe3e79 \ No newline at end of file diff --git a/src/vdbe.c b/src/vdbe.c index e53b9251a3..49183129aa 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -224,21 +224,21 @@ static VdbeCursor *allocateCursor( ** look like a number, leave it alone. */ static void applyNumericAffinity(Mem *pRec){ - if( (pRec->flags & (MEM_Real|MEM_Int))==0 ){ - double rValue; - i64 iValue; - u8 enc = pRec->enc; - if( (pRec->flags&MEM_Str)==0 ) return; - if( sqlite3AtoF(pRec->z, &rValue, pRec->n, enc)==0 ) return; - if( 0==sqlite3Atoi64(pRec->z, &iValue, pRec->n, enc) ){ - pRec->u.i = iValue; - pRec->flags |= MEM_Int; - }else{ - pRec->r = rValue; - pRec->flags |= MEM_Real; - } + double rValue; + i64 iValue; + u8 enc = pRec->enc; + if( (pRec->flags&MEM_Str)==0 ) return; + if( sqlite3AtoF(pRec->z, &rValue, pRec->n, enc)==0 ) return; + if( 0==sqlite3Atoi64(pRec->z, &iValue, pRec->n, enc) ){ + pRec->u.i = iValue; + pRec->flags |= MEM_Int; + }else{ + pRec->r = rValue; + pRec->flags |= MEM_Real; } } +#define ApplyNumericAffinity(X) \ + if(((X)->flags&(MEM_Real|MEM_Int))==0){applyNumericAffinity(X);} /* ** Processing is determine by the affinity parameter: @@ -275,7 +275,7 @@ static void applyAffinity( }else if( affinity!=SQLITE_AFF_NONE ){ assert( affinity==SQLITE_AFF_INTEGER || affinity==SQLITE_AFF_REAL || affinity==SQLITE_AFF_NUMERIC ); - applyNumericAffinity(pRec); + ApplyNumericAffinity(pRec); if( pRec->flags & MEM_Real ){ sqlite3VdbeIntegerAffinity(pRec); } @@ -292,7 +292,7 @@ int sqlite3_value_numeric_type(sqlite3_value *pVal){ int eType = sqlite3_value_type(pVal); if( eType==SQLITE_TEXT ){ Mem *pMem = (Mem*)pVal; - applyNumericAffinity(pMem); + ApplyNumericAffinity(pMem); eType = sqlite3_value_type(pVal); } return eType; @@ -3597,7 +3597,7 @@ case OP_SeekGT: { /* jump, in3 */ ** blob, or NULL. But it needs to be an integer before we can do ** the seek, so covert it. */ pIn3 = &aMem[pOp->p3]; - applyNumericAffinity(pIn3); + ApplyNumericAffinity(pIn3); iKey = sqlite3VdbeIntValue(pIn3); pC->rowidIsValid = 0;