F# faster than C#?

F# gives you simplicity and succinctness like Python with correctness , robustness and performance beyond C# or Java.
This quote from home page. Is it really? I mean performance. I tested it (very simple processing lists for example sum items) but no times have faster than C#.

I don’t know. In general I dont see how it would be faster, but it may be down to language features for certain classes of problem.

The other day, I saw a video where, for scientific computing, an application was also ported to Rust with the help of an experienced Rust dev. Initially the Rust was twice as fast as the F#. But when he fixed up some defects in the F# it ended up being faster than Rust! However, there was only his word for it.

But I also recall hearing years ago of applications being rewritten from C++ to C# and being more performant as a result. It’s probably a bit misleading though, as no doubt, when you rewrite even in the same language you usually discover a better more efficient way of solving the problem. No doubt if they’d rewritten the C++ it would have been faster too.

1 Like

With careful optimization, F# code can certainly compete with any other compiled language. It isn’t automatically faster than C#, of course, but the functional-first style has its advantages in multithreaded scenarios, for example.

If you want profiling data and example code, perhaps these are worth a look: