in reply to Re^2: How to make references more like aliases?
in thread How to make references more like aliases?
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: How to make references more like aliases?
by Limbic~Region (Chancellor) on Sep 29, 2004 at 13:29 UTC | |
by Prior Nacre V (Hermit) on Sep 30, 2004 at 03:14 UTC |