in reply to Re: aliasing
in thread aliasing
#!/usr/local/bin/perl use strict; use Benchmark qw[ cmpthese ]; sub r{ @_[ 0 .. $#_ ] = reverse @_ } sub s{ @{$_[0]} = reverse @{$_[0]} } our @n = 1 .. 1000; cmpthese( -3, { normal_reverse => q[ my @r = reverse @n; ], aliased_reverse => q[ my @r = &r( @n ); ], aliased_ref_reverse => q[ &s( \@n ); ], }); __END__ Rate aliased_reverse aliased_ref_reverse norm +al_reverse aliased_reverse 644/s -- -57% + -77% aliased_ref_reverse 1508/s 134% -- + -46% normal_reverse 2793/s 334% 85% + --
------
We are the carpenters and bricklayers of the Information Age.
Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: aliasing
by BrowserUk (Patriarch) on Jan 12, 2004 at 22:14 UTC |