[Haskell-cafe] Re: Experiments with defunctionalization, church-encoding and CPS

Heinrich Apfelmus apfelmus at quantentunnel.de
Mon Nov 2 11:15:51 EST 2009


David Menendez wrote:
> Heinrich Apfelmus wrote:
>> David Menendez wrote:
>>> Heinrich Apfelmus wrote:
>>>> Even then, the results are mixed. The Church-encoding shines in GHCi as
>>>> it should, but loses its advantage when the code is being compiled. I
>>>> guess we have to look at the core if we want to know what exactly is
>>>> going on.
>>
>>> What optimization level did you compile with?
>> No optimization.
> 
> Do you get the same results if you compile with -O2? Or does that
> screw up criterion somehow?

The results for the Church encodings are mostly the same, but now the
algebraic data type is much faster.

    touch Test.hs; ghc --make Test.hs -o Test-O2 -O2
    ./Test-O2

        data Maybe
            mean: 23.99268 ms, lb 23.64836 ms, ub 24.43737 ms, ci 0.950
        Church encoding
            mean: 146.0500 ms, lb 138.6242 ms, ub 154.0508 ms, ci 0.950
        Church encoding optimised
            mean: 93.31060 ms, lb 90.34235 ms, ub 96.25145 ms, ci 0.950


Regards,
apfelmus

--
http://apfelmus.nfshost.com



More information about the Haskell-Cafe mailing list