]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Change sqlite3_blob_reopen() to call sqlite3VdbeExec() directly rather than
authordrh <drh@noemail.net>
Sat, 21 Jan 2017 16:27:56 +0000 (16:27 +0000)
committerdrh <drh@noemail.net>
Sat, 21 Jan 2017 16:27:56 +0000 (16:27 +0000)
going through sqlite3_step().  Performance enhancement.

FossilOrigin-Name: 347df3c1fd7322e7aacaf1e9f8be81830947c482

manifest
manifest.uuid
src/vdbeblob.c

index 17270cb28569a2bd3fec0c1b44b7e07a79a9f847..334c7a3604a34e2985fe31fa1ab600a376967233 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C In\sthe\skvtest.c\stest\sutility,\sreuse\sthe\sbuffer\sinto\swhich\sblobs\sare\sread,\nrather\sthan\sreallocating\sit\sfor\seach\srow.\s\sThis\sis\sa\scloser\smatch\sto\show\nother\stest\sprograms\swork,\sand\sthus\sprovides\sa\sbetter\scomparison.
-D 2017-01-21T15:55:41.656
+C Change\ssqlite3_blob_reopen()\sto\scall\ssqlite3VdbeExec()\sdirectly\srather\sthan\ngoing\sthrough\ssqlite3_step().\s\sPerformance\senhancement.
+D 2017-01-21T16:27:56.517
 F Makefile.in 41bd4cad981487345c4a84081074bcdb876e4b2e
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc b8ca53350ae545e3562403d5da2a69cec79308da
@@ -462,7 +462,7 @@ F src/vdbe.h b0866e4191f096f1c987a84b042c3599bdf5423b
 F src/vdbeInt.h 281cb70332dc8b593b8c7afe776f3a2ba7d4255e
 F src/vdbeapi.c d6ebaa465f070eb1af8ba4e7b34583ece87bdd24
 F src/vdbeaux.c 35c9a9908174e5a26c96d15e1f98214814a39147
-F src/vdbeblob.c 824f360105b8cd43c2ec8c4611fd3b162a3a3eed
+F src/vdbeblob.c 2159f36d2c3e7ed24e3ebe99a9a4b462248c0665
 F src/vdbemem.c 3b5a9a5b375458d3e12a50ae1aaa41eeec2175fd
 F src/vdbesort.c eda25cb2d1727efca6f7862fea32b8aa33c0face
 F src/vdbetrace.c 41963d5376f0349842b5fc4aaaaacd7d9cdc0834
@@ -1547,7 +1547,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 9d197a532349f4b1caf66bbed70ca46df86cb86f
-R 2ba22a751baba0a74113cf71f6292807
+P 0d1ad13a296b22d6fe36879b56f99bd6af1acd3a
+R 6bebf342d641742884692400aca75850
 U drh
-Z 28f64e9f53e7fb024862aee0e897381f
+Z fb104ae24cf906c93b7fa008d273f235
index 1b9ab055af3b24cb75ae4f55b847e55ba9872c90..56e58c0ea3daacefca8ff1bc9b883a56e4130900 100644 (file)
@@ -1 +1 @@
-0d1ad13a296b22d6fe36879b56f99bd6af1acd3a
\ No newline at end of file
+347df3c1fd7322e7aacaf1e9f8be81830947c482
\ No newline at end of file
index 70a68b4015b071a425dfaae0bf5b091c717469c1..1efd4c92435fe5fdcb0d6a8324aa3a2b3876924c 100644 (file)
@@ -26,7 +26,6 @@ struct Incrblob {
   int nByte;              /* Size of open blob, in bytes */
   int iOffset;            /* Byte offset of blob in cursor data */
   u16 iCol;               /* Table column this handle is open on */
-  u8 isPureKV;            /* True if pTab is a pure key/value table */
   BtCursor *pCsr;         /* Cursor pointing at blob row */
   sqlite3_stmt *pStmt;    /* Statement holding cursor open */
   sqlite3 *db;            /* The associated database */
@@ -56,6 +55,7 @@ static int blobSeekToRow(Incrblob *p, sqlite3_int64 iRow, char **pzErr){
   int rc;                         /* Error code */
   char *zErr = 0;                 /* Error message */
   Vdbe *v = (Vdbe *)p->pStmt;
+  sqlite3 *db = v->db;
 
   /* Set the value of register r[1] in the SQL statement to integer iRow. 
   ** This is done directly as a performance optimization
@@ -67,9 +67,14 @@ static int blobSeekToRow(Incrblob *p, sqlite3_int64 iRow, char **pzErr){
   ** then back it up to the point where it does the OP_SeekRowid.  This could
   ** have been down with an extra OP_Goto, but simply setting the program
   ** counter is faster. */
-  if( v->pc>3 ) v->pc = 3;
-
-  rc = sqlite3_step(p->pStmt);
+  if( v->pc>3 ){
+    v->pc = 3;
+    db->nVdbeExec++;
+    rc = sqlite3VdbeExec((Vdbe*)p->pStmt);
+    db->nVdbeExec--;
+  }else{
+    rc = sqlite3_step(p->pStmt);
+  }
   if( rc==SQLITE_ROW ){
     VdbeCursor *pC = v->apCsr[0];
     u32 type = pC->aType[p->iCol];
@@ -318,7 +323,6 @@ int sqlite3_blob_open(
       }
     }
    
-    pBlob->isPureKV = (pTab->nCol==2 && pTab->iPKey==0);
     pBlob->iCol = iCol;
     pBlob->db = db;
     sqlite3BtreeLeaveAll(db);