Help for this page

Select Code to Download


  1. or download this
    use strict;
    use Benchmark qw(cmpthese);
    ...
        for_loops => sub { for(@a1) { $_ = $_ + 1 } },
        map_loops => sub { map { $_ = $_ + 1 } @a1  },
    });
    
  2. or download this
               Rate map_loops for_loops
    map_loops 499/s        --      -40%
    for_loops 835/s       67%        --