Time taken to insert ten million int→T bindings for T as each of int, float, complex and string using F# on .NET 4.5, OCaml 3.12 and GHC 7.4.2:
Value types and reified generics facilitate .NET's very efficient Dictionary implementation when handling value types like int, float and complex (unmatched by any other language/VM including C, C++ and Java). F# is 50% faster than OCaml and Haskell using the reference type string perhaps because the .NET write barrier is significantly more efficient.
Note: we use "int" to refer to ordinary 32-bit ints in F# and Haskell but 31-bit ints in OCaml. Using 32-bit ints in OCaml would be much slower because they are boxed (i.e. heap allocated).
State machines - Someone on the internet recently asserted that F# is “atrocious” for implementing state machines compared to C#. I just Googled C# state machine and foun...
2 months ago