New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"for $a..$b -> $i { ... }" loops are sometimes much slower than c-style loops #6150
Comments
From @mschaPerl6-style simple a-to-b loops are often much slower than the My "real life" example (as far as Project Euler is real life) is: A reduced example is at the bottom of this report. It outputs 111.04240975 on my machine. I'm using the latest Rakudo Star, 2017.01. See: https://irclog.perlgeek.de/perl6/2017-03-11#i_14245536 and below. #!/usr/bin/env perl6 sub perl6-loop($n) sub c-loop($n) sub MAIN($n = 10⁴) |
From @LLFournIf you think that discrepancy is impressive you're going to love this. I bash-3.2$ perl6 native-int-perf.p6 (!) On Sun, Mar 12, 2017 at 2:08 AM Michael Schaap <perl6-bugs-followup@perl.org> # New Ticket Created by Michael Schaap Perl6-style simple a-to-b loops are often much slower than the My "real life" example (as far as Project Euler is real life) is: A reduced example is at the bottom of this report. It outputs 111.04240975 on my machine. I'm using the latest Rakudo Star, 2017.01. See: https://irclog.perlgeek.de/perl6/2017-03-11#i_14245536 and below. #!/usr/bin/env perl6 sub perl6-loop($n) sub c-loop($n) sub MAIN($n = 10⁴) |
The RT System itself - Status changed from 'new' to 'open' |
From @geekosaurOn Sun, Mar 12, 2017 at 12:48 AM, Lloyd Fournier <lloyd.fourn@gmail.com>
Still quite a lot of optimization to be done on that front. WRT native int, -- |
From @MasterDuke17On Sun, 12 Mar 2017 07:27:37 -0700, allbery.b@gmail.com wrote:
FWIW. $ perl6 native-int-perf.p6 $ perl6 --version |
From @LLFournFor comparison to march on the same comp: perl6 loops are faster. c style loops are slower. Native loops are even We can probably close this RT. Seeing as the issue in the title has been LL On Sun, Nov 19, 2017 at 1:05 PM Daniel Green via RT <
|
From @ronaldxsWhat about a native perl6 range loop? Couldn't there be some way for Perl 6 / Rakudo to generate code competitive on a small range with the "native-loop" example? perl6 -e ' ...program prints... 2.10023098 # perl6 loop |
From @timoOn Mon, 20 Nov 2017 12:13:47 -0800, ronaldxs wrote:
This code will actually be turned into a `loop` loop by the optimizer at compile time. If you type the block to have a signature of `-> int $_ --> Nil` it'll get faster. The optimizer doesn't do anything like that for the `^$limit` case, however. |
From @lizmat
So, is there a reason we don’t do this on all ^10000 type loops that don’t expect the return value to be used? Because in my benchmarks, this is 3x as fast! With only 25% of the allocations, so a lot less GC churn!
That feels more that it needs a smarter spesh to me? Liz |
Migrated from rt.perl.org#130982 (status was 'open')
Searchable as RT130982$
The text was updated successfully, but these errors were encountered: