On Sun, 27 Nov 2016 10:11:51 -0800, laurent.rosenf...@googlemail.com wrote: > Hi, > > This is a simplified example of the problem I encountered: > > > my $start = now; my $c = (1..1e5).pick; say now - $start; > 9.97741524 > > my $start = now; my $c = (1..100_000).pick; say now - $start; > 0 > > 10 seconds to pick a random number between 1 and 1e5 seems to be a disaster. > > From the discussion on the #perl6 IRC channel, there are some errors with > my test: using (1e0..1e5).pick is already much faster, but still way slower > than (1..100_000).pick: > > > my $start = now; my $c = (1e0..1e5).pick; say now - $start; > 0.4222894 > > It was also suggested to me that I should use integers (i.e. not the 1e5 > Num notation), but my real case had hundreds of digits so that using for > example the 1e200 notation seemed better than typing all 200 digits. > > I found a work around: > > > my $up = 1e5.Int; > 100000 > > my $start = now; my $c = (1..$up).pick; say now - $start; > 0.00100080 > > > > So I have a solution to my problem, but it was suggested on the #perl6 IRC > channel that I should still submit a performance bug report. > > Cheers, > Laurent.
Thank you for the report. The cause of a massive slowdown was located and fixed and now the performance of infix:<..> on Nums is closer to "normal" levels. Fixed in https://github.com/rakudo/rakudo/commit/a8ba26bbe Test for another bug located during this fix and squashed with the same commit: https://github.com/perl6/roast/commit/e6b125eef1