
8 Jun
2007
8 Jun
'07
7:35 a.m.
On 6/8/07, Simon Marlow
The problem occurs when you've found the Nothing, but the rest of the list has already been sparked. You really want to throw away all those sparks, but there's no way to do that currently. One way you could improve the situation though is to only spark the next N elements in the list, limiting the amount of speculation.
I see. I was hoping that GHC would see that the sparked thunk could be garbage collected (as the rest of the list with sparks was thrown away) and would not force it. It is expensive to GC before starting every spark, of course, but maybe the GC could look for sparks that could be removed whenever it collects?
Hope this helps...
Thanks! It sure helps! Cheers, -- Felipe.