Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There are a couple of things to note about that particular comparison.

First, Haskell--particularly on GHC--gives you a ton of options for speeding your code up, including unsafe* functions and pragmas. So the fastest code is going to use things like {-# INLINE #-} and unsafeAt as opposed to ! (the array index operator). However, you would only use these things in performance critical bits of your code.

Secondly, the length of the identifier (! vs unsafeAt) actually matters because the benchmarks do not measure the number of lines--they measure the compressed size of the code. [1]

[1]: http://shootout.alioth.debian.org/help.php#gzbytes

Finally, these are all small algorithmic problems. The goal is to write the fastest code possible, not something readable or maintainable. Some of the biggest reductions in Haskell come from generalizing and reusing functions in different contexts; I expect this does not happen in the benchmarks because of limited size and the focus on performance.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: