by_groups_of( 3, \@array );
by_groups_of( 3, [ \(@array) ] );
The closure is called multiple times - your code does more here:
return sub { \@_ }->( @$list[ $start .. $stop ] );
return [ @{$ra_list}[$start .. $stop] ];
I benchmarked on a P3/Win98 system using both Cygwin/Perl5.6 and Msys/Perl5.8. I got comparable results for both versions (no discernible speed differences). These results were repeated when volume testing with array sizes between 100,000 and 500,000.
At the end of the day, either will do nicely :-)
|