diff options
author | David Mitchell <davem@iabyn.com> | 2017-07-11 13:43:26 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2017-07-27 11:30:23 +0100 |
commit | 7be75ccf16313d987eb5a6e9ff6aec9fea4ef3d4 (patch) | |
tree | ccbcd506c330c9798f660a9506c99d27f9b72c12 /lib | |
parent | 748f2c65599942147442f443949449a965f6d608 (diff) | |
download | perl-7be75ccf16313d987eb5a6e9ff6aec9fea4ef3d4.tar.gz |
optimise @array in boolean context
It's quicker to return (and to test for) &PL_sv_zero or &PL_sv_yes,
than setting a targ to an integer value or, in the vase of padav,
creating a mortal sv and setting it to an integer value.
In fact for padav, even in the scalar but non-boolean case, return
&PL_sv_zero if the value is zero rather than creating and setting a mortal.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/B/Op_private.pm | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/B/Op_private.pm b/lib/B/Op_private.pm index d1c8ebc5f5..bc57d2ca0d 100644 --- a/lib/B/Op_private.pm +++ b/lib/B/Op_private.pm @@ -156,7 +156,7 @@ $bits{$_}{6} = 'OPpTRANS_GROWS' for qw(trans transr); $bits{$_}{2} = 'OPpTRANS_IDENTICAL' for qw(trans transr); $bits{$_}{3} = 'OPpTRANS_SQUASH' for qw(trans transr); $bits{$_}{1} = 'OPpTRANS_TO_UTF' for qw(trans transr); -$bits{$_}{5} = 'OPpTRUEBOOL' for qw(padhv ref rv2hv); +$bits{$_}{5} = 'OPpTRUEBOOL' for qw(padav padhv ref rv2av rv2hv); my @bf = ( { @@ -830,6 +830,7 @@ our %ops_using = ( OPpSUBSTR_REPL_FIRST => [qw(substr)], OPpTARGET_MY => [qw(abs add atan2 chdir chmod chomp chown chr chroot concat cos crypt divide exec exp flock getpgrp getppid getpriority hex i_add i_divide i_modulo i_multiply i_subtract index int kill left_shift length link log mkdir modulo multiply nbit_and nbit_or nbit_xor ncomplement oct ord pow push rand rename right_shift rindex rmdir schomp scomplement setpgrp setpriority sin sleep sqrt srand stringify subtract symlink system time unlink unshift utime wait waitpid)], OPpTRANS_COMPLEMENT => [qw(trans transr)], + OPpTRUEBOOL => [qw(padav padhv ref rv2av rv2hv)], ); $ops_using{OPpASSIGN_COMMON_RC1} = $ops_using{OPpASSIGN_COMMON_AGG}; @@ -872,6 +873,5 @@ $ops_using{OPpTRANS_GROWS} = $ops_using{OPpTRANS_COMPLEMENT}; $ops_using{OPpTRANS_IDENTICAL} = $ops_using{OPpTRANS_COMPLEMENT}; $ops_using{OPpTRANS_SQUASH} = $ops_using{OPpTRANS_COMPLEMENT}; $ops_using{OPpTRANS_TO_UTF} = $ops_using{OPpTRANS_COMPLEMENT}; -$ops_using{OPpTRUEBOOL} = $ops_using{OPpMAYBE_TRUEBOOL}; # ex: set ro: |