Improved performance in the type handling of arithmetic operators in the VDBE.

FossilOrigin-Name: 0c0a603950c97837442d82886f947aab0acbd805
This commit is contained in:
drh
2014-08-23 17:41:15 +00:00
parent bd9507c8da
commit f1a89ede4a
3 changed files with 26 additions and 14 deletions
+6 -6
View File
@@ -1,5 +1,5 @@
C Performance\soptimization\sin\sthe\sapplyAffinity()\slogic\sinside\sthe\sVDBE.
D 2014-08-23T17:21:37.343
C Improved\sperformance\sin\sthe\stype\shandling\sof\sarithmetic\soperators\sin\sthe\sVDBE.
D 2014-08-23T17:41:15.456
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 5eb79e334a5de69c87740edd56af6527dd219308
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -284,7 +284,7 @@ F src/update.c ea336ce7b8b3fc5e316ba8f082e6445babf81059
F src/utf.c a0314e637768a030e6e84a957d0c4f6ba910cc05
F src/util.c 068dcd26354a3898ccc64ad5c4bdb95a7a15d33a
F src/vacuum.c 3728d74919d4fb1356f9e9a13e27773db60b7179
F src/vdbe.c 76f9fc30dc28751900e85f615e29cdf89c069a77
F src/vdbe.c 52ee5d589cbb171a8b096f210b69deb4a33c4369
F src/vdbe.h c63fad052c9e7388d551e556e119c0bcf6bebdf8
F src/vdbeInt.h 764a055bc9a3e61a30ba37cd4c1826f62bcf8759
F src/vdbeapi.c 49b8d2943d02d276b4efef114578251a3277f47d
@@ -1188,7 +1188,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 ce123b5c592556a8cd38b01fcc91ba76231d3098
R f59cf04b4ec2e84886c139f6982d2702
P 25f2246be404f38b4f8dd70397cd1454d46358c4
R 2a69d28bf2271ac25d420aa80c42027b
U drh
Z 3f5bd9d4c135b090a54f8be497682e06
Z c64b6b94b93d1da5e9e0a75cc412b115
+1 -1
View File
@@ -1 +1 @@
25f2246be404f38b4f8dd70397cd1454d46358c4
0c0a603950c97837442d82886f947aab0acbd805
+19 -7
View File
@@ -326,6 +326,24 @@ void sqlite3ValueApplyAffinity(
applyAffinity((Mem *)pVal, affinity, enc);
}
/*
** pMem currently only holds a string type (or maybe a BLOB that we can
** interpret as a string if we want to). Compute its corresponding
** numeric type, if has one. Set the pMem->r and pMem->u.i fields
** accordingly.
*/
static u16 SQLITE_NOINLINE computeNumericType(Mem *pMem){
assert( (pMem->flags & (MEM_Int|MEM_Real))==0 );
assert( (pMem->flags & (MEM_Str|MEM_Blob))!=0 );
if( sqlite3AtoF(pMem->z, &pMem->r, pMem->n, pMem->enc)==0 ){
return 0;
}
if( sqlite3Atoi64(pMem->z, &pMem->u.i, pMem->n, pMem->enc)==SQLITE_OK ){
return MEM_Int;
}
return MEM_Real;
}
/*
** Return the numeric type for pMem, either MEM_Int or MEM_Real or both or
** none.
@@ -338,13 +356,7 @@ static u16 numericType(Mem *pMem){
return pMem->flags & (MEM_Int|MEM_Real);
}
if( pMem->flags & (MEM_Str|MEM_Blob) ){
if( sqlite3AtoF(pMem->z, &pMem->r, pMem->n, pMem->enc)==0 ){
return 0;
}
if( sqlite3Atoi64(pMem->z, &pMem->u.i, pMem->n, pMem->enc)==SQLITE_OK ){
return MEM_Int;
}
return MEM_Real;
return computeNumericType(pMem);
}
return 0;
}