This channel is intended for people just starting with the Raku Programming Language ( Logs are available at
Set by lizmat on 8 June 2022.
00:49 jgaz joined 00:56 jgaz left 01:29 jgaz joined 01:30 jgaz left 01:31 kjp left 01:32 jgaz joined, jgaz left 01:33 jgaz joined 01:34 jgaz left 01:47 jgaz joined, jgaz left 01:49 jgaz joined, jgaz left 04:26 kjp joined 05:05 Tirifto left 05:06 Tirifto joined 05:09 Tirifto left 05:10 Tirifto joined 05:17 hythm joined 05:22 hythm left
.vushu Can somebody explain that some times this code unit module Benchmark; sub test is export { my int $n; for 0..^1000000000 { $n +=1; } say $n; } use Benchmark; sub MAIN { test; } Running it more times: 1st run: real 1m57.742s user 2m47.524s sys 0m0.586s second run: real 0m11.996s user 0m11.798s sys 0m0.049s third run: ` 05:51
@librasteve Ireal 0m12.376s user 0m12.186s sys 0m0.037s 06:02
@librasteve I'm guessing that whenever the jit decides to kicks in it's getting slower as you explained yesterday? 06:09
ab5tract_ I don’t see a speed difference with `my int $n; for ^100_000_000 { $n +=1 }`. Takes *50 seconds* on an M2 Pro… some optimization must be missing 08:08
*don’t see a speed difference between have the `say $n` at the end
08:46 dakkar joined 08:54 lizmat joined 11:44 teatwo joined, teatwo left 11:45 teatwo joined 11:47 tea3po left
lizmat And yet another Rakudo Weekly News hits the Net: 13:05
rcmlz time raku -e 'my Int $n; for ^100_000_000 {$n += 1}; say $n' 8,94s user time raku -e 'my int $n; for ^100_000_000 {$n += 1}; say $n' 2,14s user Interesting, "int" and "Int" realy does make a difference in this example (Rakudo™ v2023.10) 13:16
Just for a laugh I also tried C++ and Rust with max. optimization switched on (c++ -O3 count_to.cpp and rustc -O and booth seem to unroll and hardcode the result as it is always 0 seconds, even for very large upper bounds. It is just an artificial example .... 13:21
using raku --optimize=3 ... to trigger optimizations does not seem to have an impact in this specific example. Interesting. 13:27
librasteve o/ 13:40
I also timed raku with int (2.76s) vs perl (2.01s) so raku is 37% slower than perl when you compare apples vs apples - nice! 13:47
(raku still has a bunch of optimisation opportunities going forward + concurrent processing whereas perl is prtty much maxed out by now) 13:49
rcmlz: ah yes, static compilation and loop unrolling ... 13:52
ab5stract: I suspect (hope!) that your 50s on an M2 is for 1_000_000_000 and not 100_000_000 that you said ;-) 13:53
otherwise my M1 is 5x faster than your M2 13:54
17:05 jgaz joined
ab5tract_ librasteve: Indeed, I was running it with RAKUDO_RAKUAST=1 17:29
And I also see the speed difference between having the `say $n` and not. Weird! 17:35
Actually, scratch that. Further testing revealed a similar baseline for both 17:39
17:40 dakkar left 18:24 lizmat joined 19:13 ab5tract__ joined 19:18 ab5tract_ left, ab5tract__ is now known as ab5tract_, KOTP left 19:19 KOTP joined 23:45 tea3po joined 23:47 tea3po left, tea3po joined 23:48 teatwo left 23:53 tea3po left 23:54 tea3po joined