-
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
NativeAOT SetCreateObject on JsonTypeInfo<T> could be slimmed down #83608
Comments
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue DetailsSetCreateObject on It seems trivial to move the validation and untyped setter logic into a new non virtual method on For specifically this path SetCreateObject would probably need to be changed to return its typed delegate (or null if it's not applicable) though it could also just overwrite _createObject. Lines 86 to 90 in 46632f4
|
It might help if you could share a PR that demonstrates the change. Thanks. |
Tagging subscribers to 'linkable-framework': @eerhardt, @vitek-karas, @LakshanF, @sbomer, @joperezr Issue DetailsSetCreateObject on It seems trivial to move the validation and untyped setter logic into a new non virtual method on For specifically this path SetCreateObject would probably need to be changed to return its typed delegate as Lines 86 to 90 in 46632f4
|
@NinoFloris please provide sample and potential saving (can be in terms of number of method i.e. or if you have numbers from mstat file - you can get mstat file using these instructions: #78671 (comment) and dump it using https://gist.github.com/eerhardt/9c56e6c60952adf8b463839e7670c7ce) then you can search for methods you think can be removed. Also make sure to show the sample app you run this on and show potential size saving in perspective of total. I'm marking this as potential 8.0. |
This issue has been marked |
This issue has been automatically marked |
This issue will now be closed since it had been marked |
SetCreateObject on
JsonTypeInfo<T>
currently holds code to deal with the untyped/typed delegate and validation. This bloats every instantiation ofJsonTypeInfo<T>
while it should just do the bare minimum for the typed side to work.It seems trivial to move the validation and untyped setter logic into a new non virtual method on
JsonTypeInfo
, this would then call into the abstract SetCreateObject to just do the last bits for the typed delegate inJsonTypeInfo<T>
.For specifically this path SetCreateObject would probably need to be changed to return its typed delegate as
Func<object>
(or Func (or null if it's not applicable) though it could also just overwrite _createObject.runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoOfT.cs
Lines 86 to 90 in 46632f4
The text was updated successfully, but these errors were encountered: