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

Mario Blažević mblazevic at stilo.com
Sat May 23 08:13:34 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?

More information about the Haskell-Cafe mailing list