Skip to content
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

Add JsonPropertyDictionary and associated refactoring #53206

Merged
merged 6 commits into from
Jun 10, 2021

Conversation

steveharter
Copy link
Member

Combines property creation and access logic from three locations:

  • The new JsonObject class.
  • The JsonTypeInfo for POCOs.
  • The ParameterInfo used for calling constructors during deserialization.

The code now shared:

  • The case-(in)sensitive creation of the dictionary.
  • Deferred creation of the dictionary for a small number of properties (saves private bytes + faster startup + faster lookup).
  • The ordered List so serialization of properties is deterministic.

This code is expected to be used shortly by a more extensible POCO hooks where the property list is exposed.

No known performance serialization CPU or alloc regressions; benchmarks show +- 1%, perhaps a bit on the faster side now due to other misc optimizations including avoiding a couple "if" statements per property during serialization.

@ghost
Copy link

ghost commented May 24, 2021

Tagging subscribers to this area: @eiriktsarpalis, @layomia
See info in area-owners.md if you want to be subscribed.

Issue Details

Combines property creation and access logic from three locations:

  • The new JsonObject class.
  • The JsonTypeInfo for POCOs.
  • The ParameterInfo used for calling constructors during deserialization.

The code now shared:

  • The case-(in)sensitive creation of the dictionary.
  • Deferred creation of the dictionary for a small number of properties (saves private bytes + faster startup + faster lookup).
  • The ordered List so serialization of properties is deterministic.

This code is expected to be used shortly by a more extensible POCO hooks where the property list is exposed.

No known performance serialization CPU or alloc regressions; benchmarks show +- 1%, perhaps a bit on the faster side now due to other misc optimizations including avoiding a couple "if" statements per property during serialization.

Author: steveharter
Assignees: steveharter
Labels:

area-System.Text.Json

Milestone: -

@steveharter steveharter force-pushed the AddJsonPropertyDictionary branch 3 times, most recently from 69f0037 to 8bcc982 Compare May 25, 2021 20:12
Copy link
Contributor

@layomia layomia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@layomia layomia added this to the 6.0.0 milestone Jun 8, 2021
@steveharter steveharter merged commit 43b1f2c into dotnet:main Jun 10, 2021
@steveharter steveharter deleted the AddJsonPropertyDictionary branch June 10, 2021 16:23
@ghost ghost locked as resolved and limited conversation to collaborators Jul 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants