[email protected]
[Top] [All Lists]

Re: [Haskell-cafe] Re: Difference in Runtime but no explanation

Subject: Re: [Haskell-cafe] Re: Difference in Runtime but no explanation
From: Daniel Fischer
Date: Tue, 15 Dec 2009 23:03:38 +0100
Am Dienstag 15 Dezember 2009 21:50:22 schrieb Johann Höchtl:
> It's b, compiled without optimisations.

Don't do that. Maybe if you have huge projects with large compile times. But 
without 
optimisations, small variations can incur huge performance costs (as we see 
here).

> >
> > If a) or b), it's because the second has one more function call per list
> > element, first ($!) is called and then seq via that, while the first
> > calls seq directly.
>
> Ah, ok, I was not aware that this is realy a function call. I thought
> this is syntactic sugar only and would be rewritten into a call to
> `seq`. I think to much of a macro in this case.

It's a real function, defined in Haskell. Unfortunately, without -O, ghc is not 
keen to 
inline across module boundaries. It would be inlined within the same module. 
seq is a primitive from GHC.prim, thus it's special and doesn't produce a 
function call.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

<Prev in Thread] Current Thread [Next in Thread>