Only invoke sqlite3VdbeClearObject() from a single location, so that the

compiler is more likely to in-line the code.  Performance increase and
size reduction.

FossilOrigin-Name: c6947a96e61f71aa61ca3d70d9e2612d784ab04d60fa88852b03cfce86b1bf2b
This commit is contained in:
drh 2022-04-04 01:12:11 +00:00
parent 8703edd3e9
commit 1c8486301f
6 changed files with 23 additions and 24 deletions

View File

@ -1,5 +1,5 @@
C Performance\soptimization\sin\sthe\ssqlite3VdbeHalt()\sroutine.
D 2022-04-03T22:35:13.221
C Only\sinvoke\ssqlite3VdbeClearObject()\sfrom\sa\ssingle\slocation,\sso\sthat\sthe\ncompiler\sis\smore\slikely\sto\sin-line\sthe\scode.\s\sPerformance\sincrease\sand\nsize\sreduction.
D 2022-04-04T01:12:11.426
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -559,7 +559,7 @@ F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h f49e28c25bd941e79794db5415fdf7b202deb3bc072ed6f1ed273d578703684e
F src/sqliteInt.h 5a7867196379868a3f91c8ae172209622de2b5fabf7a5e20aa021ec44174eead
F src/sqliteLimit.h d7323ffea5208c6af2734574bae933ca8ed2ab728083caa117c9738581a31657
F src/status.c 4b8bc2a6905163a38b739854a35b826c737333fab5b1f8e03fa7eb9a4799c4c1
F src/status.c 4a3da6d77eeb3531cb0dbdf7047772a2a1b99f98c69e90ce009c75fe6328b2c0
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
F src/tclsqlite.c 1f6673991147bc2cecc08a40d22f9803b84c805b24b499fe727f392256f73474
F src/test1.c 87fda59eea3ac1eba1baef37c1967565cb1b8d6d264649f2e57f252ca5989914
@ -625,10 +625,10 @@ F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0
F src/util.c 602fe229f32a96ceccae4f40824129669582096f7c355f53dbac156c9fecef23
F src/vacuum.c 6c38ddc52f0619865c91dae9c441d4d48bf3040d7dc1bc5b22da1e45547ed0b3
F src/vdbe.c b34327e7ea940885db12df0ae7f751b53106a4eb7047c9a2bfb7efe26e39fc62
F src/vdbe.h a1d0e3b934e835e73edd146f2e7c4eadb711b5c9875c18159a57483fd78e550e
F src/vdbe.h 89f5edb1422c8783a0b29db836e409876f2b3e847f78e2b21b1fbcc48a93f85f
F src/vdbeInt.h 5f3d0abcf30c2b7a6672ad4386f18be0fca9c9b2cefe18f85a2e3df74f2613bf
F src/vdbeapi.c 5c498998c99667f16cac2519f2fa439fe46acf99a332b0caa73637fc2ab35c22
F src/vdbeaux.c 17ab5a927e22c0f8454e15b6fc03ca5be72e04fb1f455ce7fb10dc52d2153955
F src/vdbeapi.c 354c893f1500cf524cc45c32879b9c68893a28b77e3442c24668d6afe4236217
F src/vdbeaux.c 19cd7117723ef31ca31ffffb12cd0298c1b24e4a7b2d920c19f1615bb0023b6d
F src/vdbeblob.c 5e61ce31aca17db8fb60395407457a8c1c7fb471dde405e0cd675974611dcfcd
F src/vdbemem.c 062cd58c54f887dc2eeb865686251c17237f791f0e6394e9c6f7a6f3c1a7e206
F src/vdbesort.c 43756031ca7430f7aec3ef904824a7883c4ede783e51f280d99b9b65c0796e35
@ -1945,8 +1945,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 21948e6e1ccd2ce128742415d21759604ecb8902226ec4707dbd75585450f208
R 4745fb554ab36f43731027bbab700d2d
P 9564d72a0820dbcb38f905fcd42ed4c858ea8fb5f648b189ceb65380a14a785b
R dab150b94935a23a5a1bd7213e910e23
U drh
Z 869d9bdd409ceb08c178610bb5fbeb99
Z 70183e42a4b74b2de8511fa6905065a2
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
9564d72a0820dbcb38f905fcd42ed4c858ea8fb5f648b189ceb65380a14a785b
c6947a96e61f71aa61ca3d70d9e2612d784ab04d60fa88852b03cfce86b1bf2b

View File

@ -334,8 +334,7 @@ int sqlite3_db_status(
db->pnBytesFreed = &nByte;
for(pVdbe=db->pVdbe; pVdbe; pVdbe=pVdbe->pNext){
sqlite3VdbeClearObject(db, pVdbe);
sqlite3DbFree(db, pVdbe);
sqlite3VdbeDelete(pVdbe);
}
db->pnBytesFreed = 0;

View File

@ -244,7 +244,6 @@ int sqlite3VdbeMakeLabel(Parse*);
void sqlite3VdbeRunOnlyOnce(Vdbe*);
void sqlite3VdbeReusable(Vdbe*);
void sqlite3VdbeDelete(Vdbe*);
void sqlite3VdbeClearObject(sqlite3*,Vdbe*);
void sqlite3VdbeMakeReady(Vdbe*,Parse*);
int sqlite3VdbeFinalize(Vdbe*);
void sqlite3VdbeResolveLabel(Vdbe*, int);

View File

@ -1835,8 +1835,7 @@ int sqlite3_stmt_status(sqlite3_stmt *pStmt, int op, int resetFlag){
sqlite3_mutex_enter(db->mutex);
v = 0;
db->pnBytesFreed = (int*)&v;
sqlite3VdbeClearObject(db, pVdbe);
sqlite3DbFree(db, pVdbe);
sqlite3VdbeDelete(pVdbe);
db->pnBytesFreed = 0;
sqlite3_mutex_leave(db->mutex);
}else{

View File

@ -3438,7 +3438,7 @@ void sqlite3VdbeDeleteAuxData(sqlite3 *db, AuxData **pp, int iOp, int mask){
** VdbeDelete() also unlinks the Vdbe from the list of VMs associated with
** the database connection and frees the object itself.
*/
void sqlite3VdbeClearObject(sqlite3 *db, Vdbe *p){
static void sqlite3VdbeClearObject(sqlite3 *db, Vdbe *p){
SubProgram *pSub, *pNext;
assert( p->db==0 || p->db==db );
if( p->aColName ){
@ -3488,14 +3488,16 @@ void sqlite3VdbeDelete(Vdbe *p){
db = p->db;
assert( sqlite3_mutex_held(db->mutex) );
sqlite3VdbeClearObject(db, p);
if( p->pPrev ){
p->pPrev->pNext = p->pNext;
}else{
assert( db->pVdbe==p );
db->pVdbe = p->pNext;
}
if( p->pNext ){
p->pNext->pPrev = p->pPrev;
if( db->pnBytesFreed==0 ){
if( p->pPrev ){
p->pPrev->pNext = p->pNext;
}else{
assert( db->pVdbe==p );
db->pVdbe = p->pNext;
}
if( p->pNext ){
p->pNext->pPrev = p->pPrev;
}
}
sqlite3DbFreeNN(db, p);
}