develooper Front page | perl.perl5.porters | Postings from March 2011

Re: [perl #82110] Still "keys" performance regression between 5.10.1 and 5.12.3-RC1

Thread Previous
From:
Elizabeth Mattijsen
Date:
March 12, 2011 13:07
Subject:
Re: [perl #82110] Still "keys" performance regression between 5.10.1 and 5.12.3-RC1
Message ID:
4858236A-9801-46A8-988E-C7542158EF15@dijkmat.nl
On Mar 12, 2011, at 9:58 PM, Dave Mitchell wrote:
> On Sat, Mar 12, 2011 at 01:51:46PM +0100, demerphq wrote:
>> Am I right in understanding that our position is that a 30% slowdown
>> in "my @array= list " is an acceptable cost
> 
> Note its only these two
> 
>    my @array = @$arrayref;
>    my %hash  = %$hashref;
> 
> that get the pessimisation,

FWIW, in the cases where I've used this construct, it was for creating local copies of a parameter hash.  On the one hand, that would always be small hashes.  If such a subroutine gets called a lot, it would probably make sense to change the input parameters anyway.

Since there is almost no performance difference between $foo[...] / $foo{...} and $foo->[...] / $foo->{...}, I don't see a point why anyone would need to make copies just for that reason.  If there are other reasons you need a copy, then I guess you will have to pay for that.


> and not the more general versions of
> 
>    my @array = something;
>    my %hash  = something;

Good to know.  :-)



Liz
Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About