Good morning list,

 

I've been doing some profiling of SQLite 3.6.1 on PC and some of our
other proprietary platforms.  It has become evident that the function
'sqlite3VdbeSerialTypeLen' is being hit a lot: enough that the function
is adding up to a fair % of program execution time.  As the actual
calculation the function is performing is relatively trivial compared to
the costs of a function call, I propose converting the function into an
macro to reduce the cost.  I am suggesting a macro as C has no reliable
cross compiler inline functionality or at least the compilers we have
here don't seem to support the inline functionality added in C99.  

 

I made the following addition to 'vdbeInt.h' and removed the original C
function, prototype and replaced any references to the original
function.

/* Convert sqlite3VdbeSerialTypeLen into a macro: no way to inline in C!
*/

static const u8 g_aSize[] = { 0, 1, 2, 3, 4, 6, 8, 8, 0, 0, 0, 0 };

#define SQLITE3VDBESERIALTYPELEN(serial_type) ( serial_type>=12 ?
(serial_type-12)/2 : g_aSize[serial_type])

 

Please not that I don't have TCL set-up on this PC so I am unable to
test this change against the current mainline right now.  I'd be
interested in any feedback on this proposed change.

 

Cheers,

 

Daniel Brown | Software Engineer 

"The best laid schemes o' mice an' men, gang aft agley"

 

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to