On Sat, 21 Jan 2017 11:45:10 -0800, ale...@yahoo.com wrote:
> Take a look at the following examples - the second is more than
> 10x(!!!) faster:
> m: my int $i = 0; loop { if $i++ == 10_000_000 { last }}; say now -
> INIT now;rakudo-moar f97d5c: OUTPUT«2.0606382␤»
> m: my int $i = 0; loop { if $i++ == 10_000_000 { last } else {} }; say
> now - INIT now;
> rakudo-moar f97d5c: OUTPUT«0.1727145␤»
> 
> In my understanding of
> https://github.com/rakudo/rakudo/blob/nom/src/Perl6/Actions.nqp#L1675
> the first example is equivalent to:
> 
> m: my int $i = 0; loop { if $i++ == 10_000_000 { last } else { Empty }
> }; say now - INIT now;
> rakudo-moar f97d5c: OUTPUT«WARNINGS for <tmp>:␤Useless use of constant
> value Empty in sink context (line 1)␤2.120407471␤»

Thank you for the report. This is now fixed. The `else`-less version is now 
nearly twice faster:

    $ ./perl6 -e 'm: my int $i = 0; loop { if $i++ == 10_000_000 { last }}; say 
now - INIT now;'
    0.09784453
    $ ./perl6 -e 'm: my int $i = 0; loop { if $i++ == 10_000_000 { last } else 
{} }; say now - INIT now;'
    0.1641829

Fix:  https://github.com/rakudo/rakudo/commit/1815c36843ac58f
Closing without tests, since AFAIK we haven't figured out how to cover perf 
issues well yet.

Reply via email to