From: drh Date: Fri, 20 May 2016 15:53:47 +0000 (+0000) Subject: Performance optimization and size reduction on the freeP4() routine. X-Git-Tag: version-3.14.0~153 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f431a87c7cb50114aad67b893811ce122dabc88e;p=thirdparty%2Fsqlite.git Performance optimization and size reduction on the freeP4() routine. FossilOrigin-Name: 4dc56e8684e0c74fb311c7f0ef1c367da8c7bf70 --- diff --git a/manifest b/manifest index 6ef842be89..72e47730ac 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Increase\sthe\sversion\snumber\sto\s3.14.0\ssince\swe\sare\salready\smaking\ssignificant\ncode\schanges. -D 2016-05-20T15:24:14.463 +C Performance\soptimization\sand\ssize\sreduction\son\sthe\sfreeP4()\sroutine. +D 2016-05-20T15:53:47.755 F Makefile.in f59e0763ff448719fc1bd25513882b0567286317 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 306d73e854b1a92ea06e5d1e637faa5c44de53c7 @@ -448,7 +448,7 @@ F src/vdbe.c d71b935d2b21bef874680c34329adedc3b021101 F src/vdbe.h 5591b5add447096e31288b5a0a78ec5d7b5c5170 F src/vdbeInt.h ddb157974436d87652de7dc641f7191496d9a8cd F src/vdbeapi.c ba85b78fe08dc4a9ce747e62c89a2b4a4547e74c -F src/vdbeaux.c ace1875da40b7185e604586768d5ac90de7e4f7f +F src/vdbeaux.c 1d6b9a979d1036db7bc39990e9e683f19520bc5c F src/vdbeblob.c c9f2f494b911c6fa34efd9803f0a10807da80f77 F src/vdbemem.c 5cfef60e60e19cab6275d1b975bf4c791d575beb F src/vdbesort.c 91fda3909326860382b0ca8aa251e609c6a9d62c @@ -1490,7 +1490,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 3d55d24dcb27f07d1e645738ee4707e4df923036 -R 89664580415a847eedcfc718be56bf0d +P 1a0d05765fa2e69ccd4c98782cf9f5c5b2897719 +R 734aa09fb2d1f30b69a973bc3d2e2b77 U drh -Z 8bf855953d20db149698d180b3489eaf +Z d36b58bb8581f51b9b8f33e10b0489c2 diff --git a/manifest.uuid b/manifest.uuid index 1aa0fd4a5f..da9f09cbad 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1a0d05765fa2e69ccd4c98782cf9f5c5b2897719 \ No newline at end of file +4dc56e8684e0c74fb311c7f0ef1c367da8c7bf70 \ No newline at end of file diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 0f9dab8e19..bce676f10c 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -791,7 +791,7 @@ void sqlite3VdbeJumpHere(Vdbe *p, int addr){ ** the FuncDef is not ephermal, then do nothing. */ static void freeEphemeralFunction(sqlite3 *db, FuncDef *pDef){ - if( ALWAYS(pDef) && (pDef->funcFlags & SQLITE_FUNC_EPHEM)!=0 ){ + if( (pDef->funcFlags & SQLITE_FUNC_EPHEM)!=0 ){ sqlite3DbFree(db, pDef); } } @@ -801,12 +801,20 @@ static void vdbeFreeOpArray(sqlite3 *, Op *, int); /* ** Delete a P4 value if necessary. */ +static SQLITE_NOINLINE void freeP4Mem(sqlite3 *db, Mem *p){ + if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc); + sqlite3DbFree(db, p); +} +static SQLITE_NOINLINE void freeP4FuncCtx(sqlite3 *db, sqlite3_context *p){ + freeEphemeralFunction(db, p->pFunc); + sqlite3DbFree(db, p); +} static void freeP4(sqlite3 *db, int p4type, void *p4){ assert( db ); switch( p4type ){ case P4_FUNCCTX: { - freeEphemeralFunction(db, ((sqlite3_context*)p4)->pFunc); - /* Fall through into the next case */ + freeP4FuncCtx(db, (sqlite3_context*)p4); + break; } case P4_REAL: case P4_INT64: @@ -837,9 +845,7 @@ static void freeP4(sqlite3 *db, int p4type, void *p4){ if( db->pnBytesFreed==0 ){ sqlite3ValueFree((sqlite3_value*)p4); }else{ - Mem *p = (Mem*)p4; - if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc); - sqlite3DbFree(db, p); + freeP4Mem(db, (Mem*)p4); } break; }