develooper Front page | perl.perl5.porters | Postings from September 2012

aassign vs sassign (was Re: Why ugly Perl is a guide for optimizing Perl)

Thread Next
From:
David Golden
Date:
September 24, 2012 17:31
Subject:
aassign vs sassign (was Re: Why ugly Perl is a guide for optimizing Perl)
Message ID:
CAOeq1c9ogks5nXc7JgDjr-rrsjvwPi=MNcodgyL7=ii-pZRDAw@mail.gmail.com
On Mon, Sep 24, 2012 at 4:54 PM, Ruslan Zakirov <ruz@bestpractical.com> wrote:
>
> * Setup cost for aassign is big enough that several sassign operations
> are faster than one aassign. At some size things turn around. Not
> going to use it in code, but wish for turn around at two elements :)
>
> In a code I tested 41% of executed aassign OPs have two scalars on
> left hand side, 27% have a hash, 10% -  an array, 9% - three scalars.

Interesting!

If the speed delta is consistent across platforms, then "assign to N
scalars" seems like something the peephole optimizer could fix for us.

-- 
David Golden <xdg@xdg.me>
Take back your inbox! → http://www.bunchmail.com/
Twitter/IRC: @xdg

Thread Next


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