On Wed, May 21, 2014 at 11:00:57AM +0100, Nicholas Clark wrote: > Attached are two patches that remove use of dTHX in functions in quote.c > and types.c > > dTHX is ithreads only, but relatively expensive, as it needs to make a > function call to retreive a value from thread local storage. It's much > better to pass that value as a function parameter, as the caller will have > it already.
Thanks Nicholas! > I can't see how to make the same change to dbdimp.c without also changing > Driver.xst to optionaly support it. That would be tricky. The handle data structure includes the PerlInterpreter* of the thread that created it https://github.com/perl5-dbi/dbi/blob/master/DBIXS.h#L95 and the DBI's method dispatcher ensures that DBI methods are only called in the same thread that created them, i.e. https://github.com/perl5-dbi/dbi/blob/master/DBI.xs#L3300 So, for methods that are passed a handle and already declare and set a local imp_xxh pointer (e.g., D_imp_sth(sth);) I wonder if it would be worth defining a macros to get the thread pointer from the handle. Something like dTHX_from_imp_xxh(imp_xxh); Tim.
