Optimizing common F# language constructs
When we are optimizing F# language constructs, the best way to start optimizing is to identify the most commonly used F# language constructs. This is quite subtle, but important, because commonly used F# language constructs are easier to understand and learn first rather than the rarely used or more advanced ones. However, we shall focus on the constructs that often have subtle performance impacts and recommended correctness to enforce predictable behaviors.
Predictable behaviors in the context of a running code means having predictable results on the entire flow of code, including when dealing with branches, switching execution contexts such as async and parallelisms, and having awareness on exceptions.
Let's visit the most commonly used F# constructs: active pattern, pattern matching, and delegate or function lambda in F#.
Best practices of interoperability of F# delegate with .NET delegate
Delegate in F#, as we have seen, is very useful and unique...