1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Performance improvement in sqlite3_step() by creating a new mTrace flag

for the legacy xProfile pointer that is set by sqlite3_profile().

FossilOrigin-Name: e28584e8bc7b7405380064b60523fa6191f827f74075f6d117eb7732d752ba5e
This commit is contained in:
drh
2018-12-04 14:33:02 +00:00
parent b7de827137
commit 04c6747a80
5 changed files with 26 additions and 13 deletions

View File

@@ -1996,6 +1996,7 @@ void *sqlite3_trace(sqlite3 *db, void(*xTrace)(void*,const char*), void *pArg){
sqlite3_mutex_enter(db->mutex);
pOld = db->pTraceArg;
db->mTrace = xTrace ? SQLITE_TRACE_LEGACY : 0;
if( db->xProfile ) db->mTrace |= SQLITE_TRACE_XPROFILE;
db->xTrace = (int(*)(u32,void*,void*,void*))xTrace;
db->pTraceArg = pArg;
sqlite3_mutex_leave(db->mutex);
@@ -2020,6 +2021,9 @@ int sqlite3_trace_v2(
if( mTrace==0 ) xTrace = 0;
if( xTrace==0 ) mTrace = 0;
db->mTrace = mTrace;
#ifndef SQLITE_OMIT_DEPRECATED
if( db->xProfile ) db->mTrace |= SQLITE_TRACE_XPROFILE;
#endif
db->xTrace = xTrace;
db->pTraceArg = pArg;
sqlite3_mutex_leave(db->mutex);
@@ -2052,6 +2056,8 @@ void *sqlite3_profile(
pOld = db->pProfileArg;
db->xProfile = xProfile;
db->pProfileArg = pArg;
db->mTrace &= SQLITE_TRACE_NONLEGACY_MASK;
if( db->xProfile ) db->mTrace |= SQLITE_TRACE_XPROFILE;
sqlite3_mutex_leave(db->mutex);
return pOld;
}