[Haskell-cafe] GHC vs GCC
jmaessen at alum.mit.edu
Sun Mar 28 09:33:48 EDT 2010
On Sat, Mar 27, 2010 at 8:16 PM, Roman Leshchinskiy <rl at cse.unsw.edu.au>wrote:
> On 28/03/2010, at 01:36, Jan-Willem Maessen wrote:
> > It's worth pointing out that there's a bit of bang-pattern mysticism
> going on in this conversation (which has not been uncommon of late!). A
> non-buggy strictness analyzer should expose the strictness of these
> functions without difficulty.
> Actually, rangeJ is lazy in i and rangeK is lazy in i and j. GHC does unbox
> everything important here but that needs more optimisations than just
> strictness analysis. You are right, though, that GHC doesn't need bang
> patterns here.
Quite right, the condition in rangeK that mentions all variables is under
rangeK :: Int -> Int -> Int -> Int -> Int
rangeK i j k acc
| k < 1000 =
if i * i + j * j + k * k `mod` 7 == 0
So we need to apply some constructor specialization as well to notice that i
and j are always of the form (Int# i#).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe