Performance of Value Tuples in C# - 2
06/16/2018
In the previous post I have shown how value tuples differ from having multiple out parameters. The IL code has been shown and some micro-benchmarking have been done.In this post I would like re-visit one very interesting question around the performance and the generated IL Code. When we know for sure, that one of the parameters of a method is not needed, we can use a (int success, _)
syntax to tell the C# compiler that we are only interested in the first parameter of the returned value tuple.
Here is the IL when we have both parameters used:
The previous post has shown that the average of deconstructing both parameters takes 18959 ms in that given test environment.