5 ms·
The actual fastest Haskell programs are here: https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/haskell.html https://benchmarksgame-team.pages
by bufo 6y ago
The actual fastest Haskell programs are here: https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/haskell.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
These are the ones which are used for benchmark results.
The only fairly idiomatic ones (no pointers, no malloc, no unsafe) I could find are pidigits, binary-trees, and k-nucleotide. That's 3 out of 10.
- igouy 6y agoSo you did not mean "Most implementations look like C …" you meant the fastest implementations look like C ? You might find this interesting — "One can, with sufficient effort, essentially write C code in Haskell using various unsafe primitives. We would argue that this is not true to the spirit and goals of Haskell, and we have attempted in this paper to remain within the space of reasonably idiomatic Haskell. However, we have made abundant use of strictness annotations, explicit strictness, and unboxed vectors. We have, more controversially perhaps, used unsafe array subscripting in places. Are our choices reasonable?" pdf "Measuring the Haskell Gap" http://www.leafpetersen.com/leaf/publications/ifl2013/haskell-gap.pdf http://www.leafpetersen.com/leaf/publications/ifl2013/haskel...
- bufo 6y agoI think you're misunderstanding the point of my comment. Keep in mind the point of the original article: "For a language famed for its terseness, Haskell it turns out, isn’t as terse as expected - it’s average size of source code is larger than the average Go source code size." I'm responding to this. Languages with many escape hatches like Haskell or Swift will result in less idiomatic code (and potentially longer programs) when optimized for the benchmarks games. Languages with less escape hatches like Go and Ocaml less so. I don't have anything against any of these languages. Feel free to write C-like code in Haskell if you want.
- igouy 6y agoIf "idiomatic code" comes with some downside that "escape hatches" overcome, then I see that could result in "escape hatches" being used.