Uh oh!
There was an error while loading. Please reload this page.
Refactor root-level serialization logic and polymorphic value handling. - #72789
Conversation
ghost
commented
Jul 25, 2022
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue DetailsRefactors the root-level serialization/deserialization routines so that
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
eiriktsarpalis
commented
Jul 28, 2022
It must be noted that this change introduces a slight performance regression, specifically when it comes to serializing small root-level System.Text.Json.Serialization.Tests.WriteJson<Int32>.SerializeObjectProperty
Fundamentally, it is caused by this change removing the hardcoded polymorphic serialization for root-level I've been able to recover some of the performance losses by employing a secondary LRU cache specifically used for root-level polymorphic types. I think we should merge this PR and accept the performance regression, as it is essential for getting #72187 and #72681 fixed. The performance regression only impacts small, root-level polymorphic values and does not affect the statically typed APIs or the source generator which are more performance-minded. |
krwq
commented
Jul 29, 2022
If incorrect code or code wrote under wrong assumptions is faster then there is no perf regression to me. We should baseline from correct code. If there are any quick wins to gain the perf back then even better |
I made a few tweaks to the caching strategy in 97a8b7a, caching the resolved
|
Uh oh!
There was an error while loading. Please reload this page.
…ion/JsonSerializer.Helpers.cs
Refactors the root-level serialization/deserialization routines so that
JsonSerializerOptionsandJsonTypeInfo<T>overloads inJsonSerializercall into common helper methods, ensuring that metadata is being handled consistently regardless of invoked overload.objectvalues is moved to the converter layer. FixesSystem.Text.Json instances of polymorphic types emit type discriminator when serialized asobjecttypes #72187 and System.Text.Json uses inconsistent polymorphism semantics with customobjectconverters #72681.