Benchmarking disagrees with you.
The closure is generated only once - my code does more here:
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 :-)
Regards,
PN5
In reply to Re^3: How to make references more like aliases?
by Prior Nacre V
in thread How to make references more like aliases?
by Limbic~Region
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |