]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Improved performance in the type handling of arithmetic operators in the VDBE.
authordrh <drh@noemail.net>
Sat, 23 Aug 2014 17:41:15 +0000 (17:41 +0000)
committerdrh <drh@noemail.net>
Sat, 23 Aug 2014 17:41:15 +0000 (17:41 +0000)
FossilOrigin-Name: 0c0a603950c97837442d82886f947aab0acbd805

manifest
manifest.uuid
src/vdbe.c

index 8450ec16e418c4f6fb8232f6f3cb3049c5331d5e..a5fad99ba947a7d1dfe073ea4331c3139a8985db 100644 (file)
--- a/manifest
+++ b/manifest
@@ -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
index 4ee0b9c4819032d81d6716dbd605064bd7f81589..53a34bdd8dc8831f7a4713e21080622076f2cb9d 100644 (file)
@@ -1 +1 @@
-25f2246be404f38b4f8dd70397cd1454d46358c4
\ No newline at end of file
+0c0a603950c97837442d82886f947aab0acbd805
\ No newline at end of file
index 13a076cacb28b03778006befa1527e0e6ef39bed..2e797eeaf5c9f0aacbc3592c0778c8bdf23df4af 100644 (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;
 }