]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Optimizations to two VDBE accessory routines for a 0.2% performance increase.
authordrh <drh@noemail.net>
Wed, 17 Jun 2015 01:31:28 +0000 (01:31 +0000)
committerdrh <drh@noemail.net>
Wed, 17 Jun 2015 01:31:28 +0000 (01:31 +0000)
FossilOrigin-Name: 66d033b9c9a8c16b9a342be0b325bd85b8487c03

manifest
manifest.uuid
src/vdbeaux.c
src/vdbemem.c

index aa791daea37bbaf900c9fd7fafc659fac990450b..573ebff619b48b58abca91610739ad72187b1ce5 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Ensure\sthat\sthe\sCREATE\sTABLE\sAS\sstatement\scorrectly\sundoes\spartial\schanges\nto\sthe\ssqlite_master\stable\sif\sthe\sSELECT\son\sthe\sright-hand\sside\saborts\swith\nan\serror.\s\sFix\sfor\sticket\s[873cae2b6e25b]
-D 2015-06-16T16:39:01.822
+C Optimizations\sto\stwo\sVDBE\saccessory\sroutines\sfor\sa\s0.2%\sperformance\sincrease.
+D 2015-06-17T01:31:28.018
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 1063c58075b7400d93326b0eb332b48a54f53025
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -317,9 +317,9 @@ F src/vdbe.c c9b8985dfc5df9bd512342ea2e56af4be30cb31a
 F src/vdbe.h 90048aea1910f9df93e6044592bd4a466dc9c5e7
 F src/vdbeInt.h 20295e482121d13437f69985f77db211cdc8bac1
 F src/vdbeapi.c 6a0d7757987018ff6b1b81bc5293219cd26bb299
-F src/vdbeaux.c b4a127630ef81d5ea85346262f38aaf482ece4d9
+F src/vdbeaux.c 4c82d6f686f72ea7d266d26d528a171b728626f7
 F src/vdbeblob.c 4f2e8e075d238392df98c5e03a64342465b03f90
-F src/vdbemem.c 67b302dc6df64b4d6785881c5d22bd4f9b17739d
+F src/vdbemem.c 15c5ca36201efc5a603e6eb3786e09bec08b9a64
 F src/vdbesort.c f5009e7a35e3065635d8918b9a31f498a499976b
 F src/vdbetrace.c 8befe829faff6d9e6f6e4dee5a7d3f85cc85f1a0
 F src/vtab.c c535e80259ebe616467181a83a4263555b97c694
@@ -1286,7 +1286,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 0816525386ac51454b7b09a507e45b6a2cb8bf6e
-R aac2c97e6c3d9c60b2cdef77f1695ab5
+P 400e025e7c61efab71b891743c07a0862e5bb934
+R d6ec7bd1e825895971b1bb96fc6c1218
 U drh
-Z 6de6d20f4ab095b721ee46bcbe62906a
+Z dd5ab0f28ac99d3509e4690cbccf7594
index 43071000890e69aeeb7d203739af2b46480be4a5..8870f66ad6c58594d9d0bcb15af9bef7006000e8 100644 (file)
@@ -1 +1 @@
-400e025e7c61efab71b891743c07a0862e5bb934
\ No newline at end of file
+66d033b9c9a8c16b9a342be0b325bd85b8487c03
\ No newline at end of file
index 53c1d80119a772347b34088132db2098498644d9..e11981e16e17010cd203dfd4ce3cf5ac773ce480 100644 (file)
@@ -1241,12 +1241,11 @@ void sqlite3VdbeEnter(Vdbe *p){
 /*
 ** Unlock all of the btrees previously locked by a call to sqlite3VdbeEnter().
 */
-void sqlite3VdbeLeave(Vdbe *p){
+static SQLITE_NOINLINE void vdbeLeave(Vdbe *p){
   int i;
   sqlite3 *db;
   Db *aDb;
   int nDb;
-  if( DbMaskAllZero(p->lockMask) ) return;  /* The common case */
   db = p->db;
   aDb = db->aDb;
   nDb = db->nDb;
@@ -1256,6 +1255,10 @@ void sqlite3VdbeLeave(Vdbe *p){
     }
   }
 }
+void sqlite3VdbeLeave(Vdbe *p){
+  if( DbMaskAllZero(p->lockMask) ) return;  /* The common case */
+  vdbeLeave(p);
+}
 #endif
 
 #if defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)
index 7f426cf1962a00769a4f1b9fcb2b4f89f4ed424d..16054ce7f9d5cab13b8e26d888db1ba05adc6b75 100644 (file)
@@ -946,6 +946,32 @@ int sqlite3VdbeMemSetStr(
 ** If this routine fails for any reason (malloc returns NULL or unable
 ** to read from the disk) then the pMem is left in an inconsistent state.
 */
+static SQLITE_NOINLINE int vdbeMemFromBtreeResize(
+  BtCursor *pCur,   /* Cursor pointing at record to retrieve. */
+  u32 offset,       /* Offset from the start of data to return bytes from. */
+  u32 amt,          /* Number of bytes to return. */
+  int key,          /* If true, retrieve from the btree key, not data. */
+  Mem *pMem         /* OUT: Return data in this Mem structure. */
+){
+  int rc;
+  pMem->flags = MEM_Null;
+  if( SQLITE_OK==(rc = sqlite3VdbeMemClearAndResize(pMem, amt+2)) ){
+    if( key ){
+      rc = sqlite3BtreeKey(pCur, offset, amt, pMem->z);
+    }else{
+      rc = sqlite3BtreeData(pCur, offset, amt, pMem->z);
+    }
+    if( rc==SQLITE_OK ){
+      pMem->z[amt] = 0;
+      pMem->z[amt+1] = 0;
+      pMem->flags = MEM_Blob|MEM_Term;
+      pMem->n = (int)amt;
+    }else{
+      sqlite3VdbeMemRelease(pMem);
+    }
+  }
+  return rc;
+}
 int sqlite3VdbeMemFromBtree(
   BtCursor *pCur,   /* Cursor pointing at record to retrieve. */
   u32 offset,       /* Offset from the start of data to return bytes from. */
@@ -975,22 +1001,7 @@ int sqlite3VdbeMemFromBtree(
     pMem->flags = MEM_Blob|MEM_Ephem;
     pMem->n = (int)amt;
   }else{
-    pMem->flags = MEM_Null;
-    if( SQLITE_OK==(rc = sqlite3VdbeMemClearAndResize(pMem, amt+2)) ){
-      if( key ){
-        rc = sqlite3BtreeKey(pCur, offset, amt, pMem->z);
-      }else{
-        rc = sqlite3BtreeData(pCur, offset, amt, pMem->z);
-      }
-      if( rc==SQLITE_OK ){
-        pMem->z[amt] = 0;
-        pMem->z[amt+1] = 0;
-        pMem->flags = MEM_Blob|MEM_Term;
-        pMem->n = (int)amt;
-      }else{
-        sqlite3VdbeMemRelease(pMem);
-      }
-    }
+    rc = vdbeMemFromBtreeResize(pCur, offset, amt, key, pMem);
   }
 
   return rc;