develooper Front page | perl.perl5.porters | Postings from January 2008

[PATCH] Big slowdown in 5.10 @_ parameter passing

Thread Next
Rick Delaney
January 6, 2008 11:14
[PATCH] Big slowdown in 5.10 @_ parameter passing
Message ID:
On Jan 05 2008, David Landgren wrote:
> This Week on perl5-porters - 22 December 2007-29 December 2007

Hooray for summaries!  Three cheers for David and his beneficiaries!

> Big slowdown in 5.10 @_ parameter passing
>   Yves Orton forwarded a message from the DBIx-Class mailing list, where
>   they had discovered with horror that
>     my ($x, $y, $z) = @_;
>   has become unacceptably slow in 5.10 (whereas a semantically
>   equivalent code block using "shift" ran as swiftly as ever). Dave
>   Mitchell discovered that the optimiser had become confused, and was
>   running the list assignment through the code path that spends the
>   extra cycles that makes sure that
>     ($x, $y) = ($y, $x)
>   works as expected. That is, extra care has to be taken when there are
>   variables common to both sides of the assignment, otherwise things get
>   clobbered.
>     wish they had taken 5.10 for a spin earlier
>   Paul Johnson identified the patch responsible. No solution as yet.
>     it was just a teeny bug fix

The attached patch fixes the issue Dave Mitchell points out but I don't
think it has much effect on performance.  I assume the benchmarks in the
above linked thread are to point out different cycles/sec for the
different perl versions?  If not, I don't understand what they are
supposed to show.  For difference between the two perls as large as the
benchmarks show, I'd bet the 5.10 perl was built with DEBUGGING.

Anyway, the small performance to be gained by avoiding OPpASSIGN_COMMON
when unnecessary (which I estimate at none) should be regained with this
patch.  As a bonus, there should now be no difference in performance

    my ($x, $y);


    (my $x, my $y);


Rick Delaney

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About