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

The KeyValuePair converter should cache the converters for TKey and TValue #32148

Closed
steveharter opened this issue Feb 11, 2020 · 0 comments · Fixed by #36607
Closed

The KeyValuePair converter should cache the converters for TKey and TValue #32148

steveharter opened this issue Feb 11, 2020 · 0 comments · Fixed by #36607
Assignees
Labels
Milestone

Comments

@steveharter
Copy link
Member

As part of #2259, the KeyValuePair converter was identified as an area of potential perf improvement. Currently (and in 3.0\3.1) it re-enters the serializer to serialize TKey and TValue which is expensive because a Dictionary lookup occurs for each (to find the converter).

Instead, the converter should cache the converter. Caching is possible on the converter instance since the type is internal and there are no concerns about having an instance shared across different JsonSerializerOptions instances that may have different converters for TKey and TValue.

@steveharter steveharter added this to the 5.0 milestone Feb 11, 2020
@steveharter steveharter self-assigned this Feb 11, 2020
@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Feb 11, 2020
@ahsonkhan ahsonkhan removed the untriaged New issue has not been triaged by the area owner label Feb 12, 2020
@layomia layomia assigned layomia and unassigned steveharter May 15, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants