Author: timbo
Date: Fri Mar 2 07:42:01 2012
New Revision: 15197
Modified:
dbi/trunk/DBI.xs
Log:
[PATCH 4/8] in XS_DBI_dispatch, short-cut mg_find (David Mitchell)
On the assumption that the tie magic we're after is likely to be the
first one, check for it first, and only call mg_find() for the general
case.
Modified: dbi/trunk/DBI.xs
==============================================================================
--- dbi/trunk/DBI.xs (original)
+++ dbi/trunk/DBI.xs Fri Mar 2 07:42:01 2012
@@ -3175,8 +3175,13 @@
data (without having to go through FETCH and STORE methods) and
for tie and non-tie methods to call each other.
*/
- if (SvROK(h) && SvRMAGICAL(SvRV(h)) && (mg=mg_find(SvRV(h),'P'))!=NULL) {
-
+ if (SvROK(h)
+ && SvRMAGICAL(SvRV(h))
+ && (
+ ((mg=SvMAGIC(SvRV(h)))->mg_type == 'P')
+ || ((mg=mg_find(SvRV(h),'P')) != NULL)
+ )
+ ) {
if (mg->mg_obj==NULL || !SvOK(mg->mg_obj) || SvRV(mg->mg_obj)==NULL) {
/* maybe global destruction */
if (trace_level >= 3)
PerlIO_printf(DBILOGFP,