[Haskell-cafe] Re: A problem with par and modules boundaries...

Don Stewart dons at galois.com
Sat May 23 12:46:47 EDT 2009

> On Fri 22/05/09 10:51 AM , John Lato jwlato at gmail.com sent:
> > Hi Mario,
> > 
> > It looks like the parallelize function is getting inlined when it's in
> > the same file, but not when it's in a separate file.
> > 
> > Adding a {-# INLINE parallelize #-} pragma to the module with
> > parallelize recovers all the performance for me.
> > 
> > You could probably see exactly what's happening in more detail by
> > going through the Core output.
> Thank you, this advice helped. The Core output indicates that function `test'
> evaluates the arguments to `parallelize' before it calls it. In other words, the
> call to `parallelize' is optimized as a strict function call -- which it is. The
> problem is that this optimization evaluates the arguments sequentially. Compiling
> with optimizations turned off regains the parallel execution.
> I guess I will report this as a GHC bug. Or is it a feature request?

As Duncan suggessted, try with GHC head (grab a snapshot). `par` et al
are much improved.

-- Don

More information about the Haskell-Cafe mailing list