[Haskell-cafe] Re: Parallelism and expensive calculations that may not be needed

Felipe Almeida Lessa felipe.lessa at gmail.com
Fri Jun 8 07:35:48 EDT 2007


On 6/8/07, Simon Marlow <simonmarhaskell at gmail.com> wrote:
> 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.


More information about the Haskell-Cafe mailing list