This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[MERGE] refactor pp_iter
authorDavid Mitchell <davem@iabyn.com>
Thu, 15 Nov 2012 22:46:31 +0000 (22:46 +0000)
committerDavid Mitchell <davem@iabyn.com>
Thu, 15 Nov 2012 22:53:41 +0000 (22:53 +0000)
commit00ec60ba0b8283af9a17ca1eddf992ca371f0411
tree5856b9647bc1131c32603c7a1d694625e6e376e5
parentbe1927028aa6b7a3eca7cee4722e33f90aa3a8c5
parentb552b52cd84d395aed5b2147c97738f3a6132c96
[MERGE] refactor pp_iter

Refactor the code in this hot function. Chiefly, the if/else chain
was replaced with a single switch statment, and various bits of code were
tidied up, duplicate code eliminated, local vars added to avoid repeated
evaluation of expressions etc; along with big whitespace changes to fix up
indentation etc afterwards.

With these changes, these trivial benchamarks run about 7% faster:

    $x++ for @a; # @a has 30_000 elements
    $x++ for 1..30_000;

while this one stayed about the same, presumably due to the relatively
costly overhead of sv_inc():

    $x++ for 'aaa' .. 'zzz';