On Sat, 21 Jan 2017 13:52:37 -0800, [email protected] wrote:
> m: my int $i = 0; while $i < 10_000_000 { $i++ }; say now - INIT
> now;rakudo-moar 7f245f: OUTPUT«5.1848902»
> m: my (int $i, int $nosink) = 0, 0; while $i < 10_000_000 { $nosink =
> $i++ }; say now - INIT now;rakudo-moar 7f245f: OUTPUT«0.0816566»
More accurately: it's much faster when not sunk, as it gets optimized. Turn off
the optimizer and the difference vanishes:
zoffix@VirtualBox:~$ perl6 -e 'my int $i = 0; while $i < 200_000 { $ = $i++; $
= 42 }; say now - INIT now;'
0.05608007
zoffix@VirtualBox:~$ perl6 -e 'my int $i = 0; while $i < 200_000 { $i++; $ = 42
}; say now - INIT now;'
0.1869925
zoffix@VirtualBox:~$ perl6 --optimize=off -e 'my int $i = 0; while $i < 200_000
{ $ = $i++; $ = 42 }; say now - INIT now;'
0.2641866
zoffix@VirtualBox:~$ perl6 --optimize=off -e 'my int $i = 0; while $i < 200_000
{ $i++; $ = 42 }; say now - INIT now;'
0.2896187