This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
optimise @array in boolean context
authorDavid Mitchell <davem@iabyn.com>
Tue, 11 Jul 2017 12:43:26 +0000 (13:43 +0100)
committerDavid Mitchell <davem@iabyn.com>
Thu, 27 Jul 2017 10:30:23 +0000 (11:30 +0100)
commit7be75ccf16313d987eb5a6e9ff6aec9fea4ef3d4
treeccbcd506c330c9798f660a9506c99d27f9b72c12
parent748f2c65599942147442f443949449a965f6d608
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.
lib/B/Op_private.pm
op.c
opcode.h
pp.c
pp_hot.c
regen/op_private
t/perf/benchmarks
t/perf/optree.t