Replies: 2 comments
-
About your last statement: ‘it depends’, but since the concept doesn’t exist in C#, there’s no comparison for And yes, a A reference tuple is the same as the Since the compiled code is Common IL, there’s no inherent performance difference. There are, however cases where F# does optimisations you won’t find in C# (source inlining, SRTP, tailcalls) and vv, C# does optimisations you won’t find in F#. In the end, any high performant C# code can be translated to high performant F# code. They all use the same BCL, and the same Common IL and CLI. In some aspects, F# can be more performant, because it has more static knowledge of types (like type erasure, currently only on tuples, option v nullables, type alias and UoM). However, not all such optimisations are currently implemented. Though, even with that, since all target the same infra, there won’t be anything that cannot be expressed in the other language. If you have a concrete example of some code that you deem slower than its C# equivalent, feel free to share. |
Beta Was this translation helpful? Give feedback.
-
I, once again, suggest asking such questions either on SO (bigger audience), or over at https://github.com/dotnet/fsharp/discussions/categories/q-a, since it usually have more people paying attention to it. |
Beta Was this translation helpful? Give feedback.
-
List is a feature that use linked list
tuples are not value types by default
let k = (3,2) //unless let k = struct (3,2)
lambdas are not inlined if you use the
>>
operator to chain it to another functionBeta Was this translation helpful? Give feedback.
All reactions