In perl.git, the branch smueller/fewer_listops2 has been created <http://perl5.git.perl.org/perl.git/commitdiff/049047c92a97b5ef160b4e53fd68d4eb3cfb32ef?hp=0000000000000000000000000000000000000000>
at 049047c92a97b5ef160b4e53fd68d4eb3cfb32ef (commit) - Log ----------------------------------------------------------------- commit 049047c92a97b5ef160b4e53fd68d4eb3cfb32ef Author: Steffen Mueller <smuel...@cpan.org> Date: Sat Feb 22 10:08:25 2014 +0100 WIP: Optimization: Remove needless list/pushmark pairs from the OP execution This is an optimization for OP trees that involve list OPs in list context. In list context, the list OP's first child, a pushmark, will do what its name claims and push a mark. Then the list's other children will do their stack pushing. Finally, the list OP will be executed and do nothing but undo what the pushmark has done. This is because the main effect of the list OP only really kicks in if it's not in array context (actually, it should probably only kick in if it's in scalar context, but I don't know of any valid examples of list OPs in void contexts). This optimization is quite a measurable speed-up for array or hash slicing and some other situations. Another (contrived) example is that (1,2,(3,4)) now actually is the same, performance-wise as (1,2,3,4), albeit that's rarely relevant. The price to pay for this is a slightly convoluted (by standards other than the perl core) bit of optimization logic that has to do single-OP look-ahead on any OP in the peephole optimizer. WIP! Right now, some tests still fail, but on quick inspection, those are exclusively OP-tree inspecting tests. Citation required. This raises an interesting point: This is a relatively significant change to the structure of some OP trees, particularly when dumped with the -exec option of B::Concise. The OP tree checking tests have a Perl-version-dependent-test feature, but that seems inadequate to encompass changes this significant to the test output. What to do? ----------------------------------------------------------------------- -- Perl5 Master Repository