- Notifications
You must be signed in to change notification settings - Fork5.1k
Performance improvements inJsonValue
.#103733
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Tagging subscribers to this area: @dotnet/area-system-text-json,@gregsdennis |
Just confirming that we're not losing the ability to store arbitrary objects in |
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.
src/libraries/System.Text.Json/src/System/Text/Json/Nodes/JsonObject.IDictionary.csShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/libraries/System.Text.Json/src/System/Text/Json/Nodes/JsonValueOfElement.csShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/libraries/System.Text.Json/src/System/Text/Json/Nodes/JsonValue.CreateOverloads.csShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
/ba-g suppressing unrelated test failure to merge ahead of snap. |
d9b9676
intodotnet:mainUh oh!
There was an error while loading.Please reload this page.
* 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
JsonNode
design is that it permits encapsulation of arbitrary .NET objects via theJsonValue
type. This is known to create performance problems since it's not possible to introspectJsonValue
instances 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
JsonValue
so that common primitive types and deserialized values backed byJsonElement
are fully segregated from the implementation that admits arbitrary objects. Consequently this change recordssubstantial performance improvements: