On 4/25/07, Brandon Black <blblack gmail.com> wrote:
> ISA Modification Efficiency:
Here's a patch that re-uses the PL_delaymagic that was
already in
pp_aassign (plus a new thrdvar PL_delayedisa) to speed up
assignments
to ISA. Previously, " Foo::ISA = qw/A B C
D/;" would call
mro_isa_changed_in() 9 times in a row because of how array
magic
works, and with this patch it only gets called once.
The same delaymagic could be added to pp_push/pp_unshift to
speed up
push/unshift of several values onto ISA in a single statement,
but I
left that out since those two functions are relatively small
and fast
and probably don't need the bloat of even a few extra
comparisons.
People who want push( ISA, qw/super long list/) to be efficient
can
just do ISA = ( ISA, qw/super long list/) to get the
delaymagic
benefits (I've docced that under PERFORMANCE in mro.pm).
-- Brandon
|