From: drh <> Date: Fri, 14 May 2021 20:01:36 +0000 (+0000) Subject: Small performance improvement for sqlite3BtreeInsert(). X-Git-Tag: version-3.36.0~99 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=49bb56e9b08bae2dbee39d065aeac7caabf03081;p=thirdparty%2Fsqlite.git Small performance improvement for sqlite3BtreeInsert(). FossilOrigin-Name: 4ae64484c57740333322cebd713b50b01a5a5838d41c65f67e26d65769770789 --- diff --git a/manifest b/manifest index 7bc57312f6..0ead98eac2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Avoid\sadding\ssuperfluous\svirtual\sWHERE\sclause\sterms\sthat\smight\sarise\sdue\nto\sthe\sconstant\spropagation\soptimization. -D 2021-05-14T15:37:00.870 +C Small\sperformance\simprovement\sfor\ssqlite3BtreeInsert(). +D 2021-05-14T20:01:36.170 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -484,7 +484,7 @@ F src/auth.c 08954fdc4cc2da5264ba5b75cfd90b67a6fc7d1710a02ccf917c38eadec77853 F src/backup.c 3014889fa06e20e6adfa0d07b60097eec1f6e5b06671625f476a714d2356513d F src/bitvec.c 17ea48eff8ba979f1f5b04cc484c7bb2be632f33 F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6 -F src/btree.c 5372d8bca3374145477e129be5ed6e907731e1d117c0dc1b524b536f1cc0e577 +F src/btree.c 43e755a22fa4e94cc3203b604200946088c1bb9f1b80ebacde496d515161c7e7 F src/btree.h 096cc53baa58be22b02c896d1cf933c38cfc6d65f9253c1367ece8cc88a24de5 F src/btreeInt.h 7bc15a24a02662409ebcd6aeaa1065522d14b7fda71573a2b0568b458f514ae0 F src/build.c a7866beda66a7c8971e013674c7f659d19977d9ad51e11032479b1f754d1ef21 @@ -1913,7 +1913,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 e994c9f29f7a561dd5f30573865b0f793fb1388af09a2afb9b1a5b037ea52f89 -R f40d700cac45a3fbd24f4a4f0d5ee607 +P cf63abbe559d04f993f99a37d41ba4a97c0261094f1d4cc05cfa23b1e11731f5 +R 56636569b2dc12071ca5587b9d291c1a U drh -Z 0bdc8a9f4500418f11b804dea881401d +Z 87019381c8d9b7e2ea4914c987f0da73 diff --git a/manifest.uuid b/manifest.uuid index d2b8b672a8..8fb0a89515 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -cf63abbe559d04f993f99a37d41ba4a97c0261094f1d4cc05cfa23b1e11731f5 \ No newline at end of file +4ae64484c57740333322cebd713b50b01a5a5838d41c65f67e26d65769770789 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 7ee0b4eaf6..e38a7c07c5 100644 --- a/src/btree.c +++ b/src/btree.c @@ -547,7 +547,8 @@ static void invalidateIncrblobCursors( int isClearTable /* True if all rows are being deleted */ ){ BtCursor *p; - if( pBtree->hasIncrblobCur==0 ) return; + // if( pBtree->hasIncrblobCur==0 ) return; + assert( pBtree->hasIncrblobCur ); assert( sqlite3BtreeHoldsMutex(pBtree) ); pBtree->hasIncrblobCur = 0; for(p=pBtree->pBt->pCursor; p; p=p->pNext){ @@ -8752,7 +8753,9 @@ int sqlite3BtreeInsert( assert( pX->pKey==0 ); /* If this is an insert into a table b-tree, invalidate any incrblob ** cursors open on the row being replaced */ - invalidateIncrblobCursors(p, pCur->pgnoRoot, pX->nKey, 0); + if( p->hasIncrblobCur ){ + invalidateIncrblobCursors(p, pCur->pgnoRoot, pX->nKey, 0); + } /* If BTREE_SAVEPOSITION is set, the cursor must already be pointing ** to a row with the same key as the new entry being inserted. @@ -9179,7 +9182,7 @@ int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){ /* If this is a delete operation to remove a row from a table b-tree, ** invalidate any incrblob cursors open on the row being deleted. */ - if( pCur->pKeyInfo==0 ){ + if( pCur->pKeyInfo==0 && p->hasIncrblobCur ){ invalidateIncrblobCursors(p, pCur->pgnoRoot, pCur->info.nKey, 0); } @@ -9523,7 +9526,9 @@ int sqlite3BtreeClearTable(Btree *p, int iTable, int *pnChange){ /* Invalidate all incrblob cursors open on table iTable (assuming iTable ** is the root of a table b-tree - if it is not, the following call is ** a no-op). */ - invalidateIncrblobCursors(p, (Pgno)iTable, 0, 1); + if( p->hasIncrblobCur ){ + invalidateIncrblobCursors(p, (Pgno)iTable, 0, 1); + } rc = clearDatabasePage(pBt, (Pgno)iTable, 0, pnChange); } sqlite3BtreeLeave(p);