1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

Add the new internal interface sqlite3DbNNFreeNN(db,ptr) where both the

db and ptr parameters are guaranteed to be non-NULL.  Use this where
appropriate to save more than 2 million CPU cycles on the standard
performance test.

FossilOrigin-Name: e5eaa80e81fdf86f2875a912b880272b8d099b82b08e945a7988c5dd0fe9d6b5
This commit is contained in:
drh
2022-08-22 02:00:26 +00:00
parent 05cb948bf7
commit 41ce47c4f4
18 changed files with 128 additions and 69 deletions

View File

@@ -76,6 +76,7 @@ struct SortCtx {
** If bFree==0, Leave the first Select object unfreed
*/
static void clearSelect(sqlite3 *db, Select *p, int bFree){
assert( db!=0 );
while( p ){
Select *pPrior = p->pPrior;
sqlite3ExprListDelete(db, p->pEList);
@@ -95,7 +96,7 @@ static void clearSelect(sqlite3 *db, Select *p, int bFree){
sqlite3WindowUnlinkFromSelect(p->pWin);
}
#endif
if( bFree ) sqlite3DbFreeNN(db, p);
if( bFree ) sqlite3DbNNFreeNN(db, p);
p = pPrior;
bFree = 1;
}
@@ -1501,9 +1502,10 @@ KeyInfo *sqlite3KeyInfoAlloc(sqlite3 *db, int N, int X){
*/
void sqlite3KeyInfoUnref(KeyInfo *p){
if( p ){
assert( p->db!=0 );
assert( p->nRef>0 );
p->nRef--;
if( p->nRef==0 ) sqlite3DbFreeNN(p->db, p);
if( p->nRef==0 ) sqlite3DbNNFreeNN(p->db, p);
}
}