Haskell: performance

It turned out that it's not Haskell who was slow in my previous Fibonacci test. It was my lack of Haskell knowledge. Haskell has two integral types - Int, which has bounds -2147483648..2147483647 and Integer, which is unbounded. Both types implement Integral type class, so out fib function can be defined in terms of this type class:
OK, now we can test performance of the function parametrizing it with the two concrete types. Integer first:
We get our previous result ~15 seconds which is rather slow. Now test it with Int type:
Whoa! The Int type is ~6 times faster than Integer! And with result of 2.8 seconds Haskell's took the third position in our small rating :) Current list (in seconds):
  • C# - 1.26
  • F# - 1.38
  • Nemerle - 1.45
  • Haskell - 2.8
  • Clojure - 9
  • Erlang - 17
  • Ruby - 60
  • Python - 120





Comments

Anonymous said…
emperor casino bonus: 50 Free Spins | Shootercasino.com
100 free 제왕 카지노 spins with no deposit 바카라 사이트 required! Get up to 500 free spins 샌즈카지노 in online casino games or bonus rounds with a deposit bonus.

Popular posts from this blog

Regular expressions: Rust vs F# vs Scala

Hash maps: Rust, F#, D, Go, Scala