-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid Type.MakeGenericType when (de)serializing objects #35028
Comments
MakeGenericType over valuetypes is the thing that contributes to most of JITtting though - MakeGenericType over a reference type usually ends up using shared code and JIT doesn't have to be spun up. I wrote a quick summary of generics in .NET in a twitter thread recently: https://threadreaderapp.com/thread/1244602445461950470.html |
The two main benefits:
|
@MichalStrehovsky, Could we remove/reduce the need to JITing in the case of value types on generics by having the Jit transform the valuetype to a pointer to a valuetype? |
Yes, that's kind of how Universal Shared Code looks like. It can be used for any |
@MichalStrehovsky, I believe that is what I was referring to when I wrote this issue: #37143. |
Closing this for the following reasons:
A prototype of the original idea is located at https://github.com/steveharter/runtime/tree/UseObjectAsT. |
As part of researching approaches to #1568 it was found that avoiding
Type.MakeGenericType
for our object converter (non-collections and non-valuetypes) will help "reach" scenarios (AOT platforms that may not support it) as well as improve CPU performance and reduce memory consumption.This means that the
T
inJsonConverter<T>
will be of typeSystem.Object
; some changes are necessary in the object factory and JsonConverter base classes for this to work.The text was updated successfully, but these errors were encountered: