]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Some optimization comments added to vdbe.c. No functional changes to code.
authordrh <drh@noemail.net>
Fri, 29 Apr 2016 02:55:05 +0000 (02:55 +0000)
committerdrh <drh@noemail.net>
Fri, 29 Apr 2016 02:55:05 +0000 (02:55 +0000)
FossilOrigin-Name: e7c22e3bffce63f3b47fa3683be8c00c42b2a7d3

manifest
manifest.uuid
src/vdbe.c

index 4d312042a15709bcfb91d4e679728e68a4ba2ae4..da4cac8196c9c04b7d24e3a283bfba5bab388c02 100644 (file)
--- 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
index fd604e04b34e3a8299c2f3118055ec1607a6263d..74550e35d8f031b6f64cc41e9a51a5bca462ffad 100644 (file)
@@ -1 +1 @@
-9f15a520deb9f1d4ecaa3bfff82bd57ef122aadb
\ No newline at end of file
+e7c22e3bffce63f3b47fa3683be8c00c42b2a7d3
\ No newline at end of file
index 244a4ad063ab7efa3011c456818c08818f76f505..5fba14a5c351870216b6a5a2834501de72ef643a 100644 (file)
@@ -215,7 +215,7 @@ static VdbeCursor *allocateCursor(
       (eCurType==CURTYPE_BTREE?sqlite3BtreeCursorSize():0);
 
   assert( iCur>=0 && iCur<p->nCursor );
-  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;