Why does the JIT box ValueTuple twice, even when TFrom == TTo? #58535
Replies: 1 comment 2 replies
-
@Jehoel in your specific case it should help to add |
Beta Was this translation helpful? Give feedback.
-
@Jehoel in your specific case it should help to add |
Beta Was this translation helpful? Give feedback.
-
In this thread, I used IL Emit to allow a generic method over
ValueTuple
to retain C# tuple member names after re-learning that theis
operator inif( someValueType is TTo other )
will cause boxing ofsomeValueType
....but I also saw that the JIT in .NET 5.0 still boxes
someValueType
when its typeTFrom
is the same asTTo
- which should be entirely unnecessary.Screenshot proof:
To reproduce, copy and paste this into a .NET 5.0 console project as a Release build:
Beta Was this translation helpful? Give feedback.
All reactions