[Haskell-cafe] Optimization demonstration

Brandon Allbery allbery.b at gmail.com
Tue Feb 27 15:38:00 UTC 2018


On Tue, Feb 27, 2018 at 10:06 AM, Dušan Kolář <kolar at fit.vut.cz> wrote:

> Unfortunately, in this case the C is much more faster (it prints the
> result immediately), at least on my machine. Is it due to a fact that C
> compiler does a brutal optimization leading to compile-time evaluation,
> while ghc is not able to do that?
>
>
ghc is less prone to invoke that kind of optimization, but sometimes can do
so. And yes, gcc is decidedly "brutal" with -O2: inspect the generated
assembler and you'll find that it just prints a constant.

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180227/d0ca76c5/attachment.html>


More information about the Haskell-Cafe mailing list