# New Ticket Created by Laurent Rosenfeld # Please include the string: [perl #130190] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=130190 >
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.