Uh oh!
There was an error while loading. Please reload this page.
Performance improvements in JsonValue. - #103733
Conversation
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis |
gregsdennis
commented
Jun 19, 2024
Just confirming that we're not losing the ability to store arbitrary objects in |
eiriktsarpalis
commented
Jun 19, 2024
We couldn't do that. This change simply isolates that use case from the hot path scenaria. |
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
Jun 20, 2024
/ba-g suppressing unrelated test failure to merge ahead of snap. |
* Performance improvements in JsonValue. * Fixdotnet#103715. * Add more test cases and fix a number of bugs related to DeepEquals and escaping. * Fix number handling corner case.
One of the oddities of
JsonNodedesign is that it permits encapsulation of arbitrary .NET objects via theJsonValuetype. This is known to create performance problems since it's not possible to introspectJsonValueinstances without serializing and deserializing the underlying object first. The problem is fairly pervasive since JSON primitives such as boolean, numbers and strings are all represented usingJsonValue.This PR refactors the implementation of
JsonValueso that common primitive types and deserialized values backed byJsonElementare fully segregated from the implementation that admits arbitrary objects. Consequently this change records substantial performance improvements: