Since I decided to diversify myself with Rust and Go I became overly concerned about copying / reference / moving etc.
And recently I really wondered if ValueTuple
also suffer from the typical caveat of struct
that is that its size should not be greater than 16 bytes to avoid a performance when copying the value type here and there: https://stackoverflow.com/a/1082341/4636721
So if say we have a value tuple (decimal, decimal, decimal, decimal)
that means we are better off using classic Tuple<decimal, decimal, decimal, decimal>
class to pass around that tuple?
[EDIT]
An example of use case: let's say the method below would be call a lot
public (decimal, decimal, decimal, decimal) GetSuperImportantTuple(int input)
{
var aParameter = GetAParameter(input);
// Copy when getting that tuple
var tuple = GetA4DecimalsValueTuple();
// Copy into that function
var anotherParameter = GetAnotherParameter(tuple);
// Copy when returning the value
return TransformValueTuple(tuple, anotherParameter);
}