joes 2004/07/12 20:35:45
Modified: glue/perl/xsbuilder apreq_xs_tables.h
Log:
Only prefetch the key when the iterator is active (SvCUR > 0). The problem
is that apreq_xs_table_magic_copy gets called on EXISTS and STORE (not just
FETCH), so the extra method call is wasteful. By checking that the iterator is
> 0 before running Perl_magic_getpack, we can eliminate that ineffiency outside
of C<< while (($a,$b) = each %$table) {...} >> loops.
Revision Changes Path
1.13 +4 -2 httpd-apreq-2/glue/perl/xsbuilder/apreq_xs_tables.h
Index: apreq_xs_tables.h
===================================================================
RCS file: /home/cvs/httpd-apreq-2/glue/perl/xsbuilder/apreq_xs_tables.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- apreq_xs_tables.h 13 Jul 2004 02:44:55 -0000 1.12
+++ apreq_xs_tables.h 13 Jul 2004 03:35:45 -0000 1.13
@@ -25,8 +25,10 @@
{
/* prefetch the object */
MAGIC *tie_magic = mg_find(nsv, PERL_MAGIC_tiedelem);
- Perl_magic_getpack(aTHX_ nsv, tie_magic);
- return -1;
+ SV *obj = SvRV(tie_magic->mg_obj);
+ if (SvCUR(obj))
+ Perl_magic_getpack(aTHX_ nsv, tie_magic);
+ return 0;
}
static const MGVTBL apreq_xs_table_magic = {0, 0, 0, 0, 0,