[Haskell-cafe] Parallel compilation and execution?

Brandon Moore brandon_m_moore at yahoo.com
Thu May 26 15:09:36 CEST 2011

>From: michael rice, Thursday, May 26, 2011
>Subject: Re: [Haskell-cafe] Parallel compilation and execution?
>Thank, Daniel
>Multiple threads are in evidence in my system monitor, but I wonder why I'm getting two different answers, one twice the other. The first is the parallel solution and the second is the non.

Not exactly twice - (2n-1). What you get from counting all nodes in a binary tree (of function calls),
compared to counting just the leaves.

A program using only pure code, par, and pseq should be deterministic, so if it gets different
value by building with and without threaded, changing the number of threads, or just running
again, that's a bug in GHC (If it runs out of memory sometimes and not other times, that's
not technically a bug, but still interesting).

Replacing par with the second argument should also give an equivalent program. pseq isn't
really parallel at all, but if you'd like to remove it, then replacing it with seq or just the second
argument might change strictness and evaluation order, but shouldn't change the result.

More information about the Haskell-Cafe mailing list