Where in Rakudo is the slowdown? I'm by no means a compiler developer, but I enjoy tinkering.
Dan On Wed, Apr 13, 2016 at 8:04 AM, Elizabeth Mattijsen via RT < perl6-bugs-follo...@perl.org> wrote: > > On 12 Apr 2016, at 04:40, Daniel Green (via RT) < > perl6-bugs-follo...@perl.org> wrote: > > > > # New Ticket Created by Daniel Green > > # Please include the string: [perl #127881] > > # in the subject line of all future correspondence about this issue. > > # <URL: https://rt.perl.org/Ticket/Display.html?id=127881 > > > > > > > '@array[0, 3, 7]' is much slower than '(@array[0], @array[3], @array[7])' > > > > > > time perl6 -e 'my @a = ^500;my @f;my $s = @a.elems;loop (my $i1 = 0; $i1 > < > > $s-1; $i1++) { loop (my $i2 = $i1+1; $i2 < $s; $i2++) { @f.push(@a[$i1, > > $i2]) } };' > > > > real 0m14.974s > > user 0m14.947s > > sys 0m0.017s > > > > > > time perl6 -e 'my @a = ^500;my @f;my $s = @a.elems;loop (my $i1 = 0; $i1 > < > > $s-1; $i1++) { loop (my $i2 = $i1+1; $i2 < $s; $i2++) { @f.push((@a[$i1], > > @a[$i2])) } };' > > > > real 0m0.897s > > user 0m0.877s > > sys 0m0.017s > > > > > > With Rakudo version 2016.03 built on MoarVM version 2016.03 > > This is a known issue. Anytime you use lists, the optimization paths are > not that well developed yet. To give you another example: > > $ 6 'for ^100000 { my ($a,$b) = 42,666 }' > real 0m1.628s > user 0m1.582s > sys 0m0.041s > > $ 6 'for ^100000 { my $a = 42; my $b = 666 }' > real 0m0.180s > user 0m0.152s > sys 0m0.026s > > $ 6 'for ^100000 { my $a; my $b }' > real 0m0.170s > user 0m0.144s > sys 0m0.025s > > $ 6 'say (1628 - 170) / (180 - 170)’ > 145.8 > > > Liz > >