# New Ticket Created by Steve Schulze
# Please include the string: [perl #117403]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=117403 >
my @j := (0 .. *).list;
say @j.first: {$^_ > 10};
returns 11 in .01 seconds on my system
my @l := gather map {take $_ }, 0 .. *;
say @l.first: {$^_ > 10};
returns 11 in 63.97 seconds on my system
thundergnat: r: my @harshad := gather for 1 .. * { take $_ if $_ %%
[+] .comb }; say @harshad.first: {$^_ > 1000}; # takes 5400 seconds
locally to return an answer
p6eval: rakudo 25a9d6: OUTPUT«(timeout)»
pmichaud: right, so that tells me there's a bug somewhere in the
list code.
pmichaud: and the way to fix that is by fixing the list code, not
by patching around the bug.
thundergnat: Should I file a bug report then?
pmichaud: sure, that works.
thundergnat: pmichaud: It only seems to occur in lists created using
gather take. I wonder if it is some weird interaction between GatherIter
and ListIter?
pmichaud: oh, GatherIter is indeed suboptimal for a lot of stuff.
there definitely needs to be some improved
communication between GatherIter and MapIter
I suspect that MapIter tries to go too far
ahead when confronted with an infinite GatherIter
or, more likely...
the gather isn't able to signal that it's
infinite, and that's causing MapIter to go too far ahead