[Haskell-cafe] In-place modification

Donald Bruce Stewart dons at cse.unsw.edu.au
Sun Jul 15 12:22:33 EDT 2007

>    Brandon wrote:
>    > Seems to me you get the best picture by picking two
>    algorithms, one
>    which favors C# and one which favors Haskell, and
>    implementing both
>    in both languages.
>    Sounds good to me.  What is a good problem that favors
>    Haskell?

NO. We just *did* this.

Firstly, to compare GHC Haskell and C#, look at the shootout:


C# does better than I expected! 2.6x faster than one Haskell program,
usually 2-4x slower.  Really poor at lightweight concurrency.
Don't do toy benchmarks here, fix the C# ones on the shootout!

Secondly, we just did this for prime sieves:

  * imperative bit sieves on this list, in C# and Haskell, roughly
    identical runtimes, though Hugh didn't benchmark the fastest Haskell ones.

    This is to be expected, every compiled languages runs into the cache
    on this benchmark anyway, see here:


  * lazy sieves, C# was 100x slower than the naive Haskell implementation.
    That's the real story here, laziness is just hard and painful in C#.

However, if you're keen, and agreeing to implement the same algorithm on
both systems, I'd have a go in C# at 'chameneos', a concurrency


or maybe 'pidigits', a lazy pi generator,


Should be a challenge in C#.

-- Don

More information about the Haskell-Cafe mailing list