diff options
author | Ruslan Zakirov <ruz@bestpractical.com> | 2012-10-17 20:04:58 +0400 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-12-11 08:59:41 -0800 |
commit | 88e2091baeacd9a40eab4dac8601e88b3797e385 (patch) | |
tree | e33f6bc9e99a9056dcfe31333b85e3fe358dcf94 /pp_hot.c | |
parent | 1c4ea38437d309ec547e78e6f14940e799920be3 (diff) | |
download | perl-88e2091baeacd9a40eab4dac8601e88b3797e385.tar.gz |
don't create a copy of keys if it's not LVALUE context
Making another copy slows things down. We can avoid it
if aassign is not expected to return LVALUEs.
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -992,9 +992,12 @@ PP(pp_aassign) HV *hash; I32 i; int magic; + U32 lval = 0; PL_delaymagic = DM_DELAY; /* catch simultaneous items */ gimme = GIMME_V; + if (gimme == G_ARRAY) + lval = PL_op->op_flags & OPf_MOD || LVRET; /* If there's a common identifier on both sides we have to take * special care that assigning the identifier on the left doesn't @@ -1093,7 +1096,7 @@ PP(pp_aassign) while (relem < lastrelem+odd) { /* gobble up all the rest */ HE *didstore; assert(*relem); - sv = gimme == G_ARRAY ? sv_mortalcopy(*relem) : *relem; + sv = lval ? sv_mortalcopy(*relem) : *relem; relem++; assert(*relem); tmpstr = sv_mortalcopy( *relem++ ); /* value */ |