[Haskell-cafe] Optimization demonstration

Ryan Reich ryan.reich at gmail.com
Tue Feb 27 17:26:07 UTC 2018


In other words, it's not competition with the language C but with its
popular compiler. Choose an example that doesn't simplify and you'll get a
fairer contest.

On Feb 27, 2018 07:52, "Brandon Allbery" <allbery.b at gmail.com> wrote:

> 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
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180227/f97a71a1/attachment.html>


More information about the Haskell-Cafe mailing list