SPUG: return value of assignment operator
BenRifkah Bergsten-Buret
mail.spammagnet at gmail.com
Wed Apr 30 13:43:44 PDT 2008
On Wed, Apr 30, 2008 at 12:52 PM, Yitzchak Scott-Thoennes
<sthoenna at efn.org> wrote:
> On Wed, April 30, 2008 12:13 pm, BenRifkah Bergsten-Buret wrote:
> > According to my setup* relying on the returned lvalue is less efficient:
>
>
> > Rate increment_separately increment_lhs
> > increment_separately 5555556/s -- -28%
> > increment_lhs 7758621/s 40% --
>
> You're reading it backwards; the increment_lhs is 40% faster than
> separately.
>
D'oh. Yeah, Michael pointed this out to me as well. I got tripped up
on the -28% and interpreted it as separately taking 28% less time than
lhs. It's obvious now looking at the number of iterations per second.
I was somewhat surprised by my initial interpretation. This makes
more sense to me.
So apparently for this kind of incrementation you can get a
substantial performance boost by relying on Perl returning the lhs.
-- Ben
More information about the spug-list
mailing list