If I need memory, I believe that there were some performance problems with deeply nested pattern matches in DU with a large number of cases / fields in each case, but that was before 2.0, and I believe that they fixed the implementation in such a way that in these scenarios are currently well optimized and have no egregious performance issues. (sorry, do not quote).
But even when optimizing DU de sugar in a rather large amount of code. Thus, even if they can work (and probably better) than any equivalent manual control flow, there is a possibility that you could overflow the stack with the simple number of instructions emitted for the function / method body (but that would be pretty a complicated scenario, since the .NET stack size by default is ~ 1 MB, however, it can certainly lead to an earlier than usual stack overflow in a non-recursive method / function not associated with the tail, including a large DU match, but again it is unlikely to such an extent that you should really be wary of this scenario).
I do not believe that this will change the performance characteristics (since we are talking about heaps of selected objects anyway), but for convenience / readability it sometimes helps to wrap your DU type data in a record type so that data fields are called and pattern matching in a subset of data fields simpler (e.g. {Name="Stephen"} instead of (_,_,_,_,_,_,_,"Stephen",_,_,_,_,_) ). (@TomasPetricek beat me up to this offer, did not see that I read his answer on my first)
source share