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

Generate fast-path serialize logic for nullable structs #59719

Closed
layomia opened this issue Sep 28, 2021 · 5 comments
Closed

Generate fast-path serialize logic for nullable structs #59719

layomia opened this issue Sep 28, 2021 · 5 comments

Comments

@layomia
Copy link
Contributor

layomia commented Sep 28, 2021

The JSON source generator doesn't generate optimized serialization logic for nullable structs, but it could. The following method should be extended to include this support:

private string GenerateForNullable(TypeGenerationSpec typeMetadata)

See also #51945.

@layomia layomia added area-System.Text.Json help wanted [up-for-grabs] Good issue for external contributors labels Sep 28, 2021
@layomia layomia added this to the 7.0.0 milestone Sep 28, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Sep 28, 2021
@ghost
Copy link

ghost commented Sep 28, 2021

Tagging subscribers to this area: @dotnet/area-system-text-json
See info in area-owners.md if you want to be subscribed.

Issue Details

The JSON source generator doesn't generate serialization logic for nullable structs, but it could. The following method should be extended to include this support:

private string GenerateForNullable(TypeGenerationSpec typeMetadata)

See also #51945.

Author: layomia
Assignees: -
Labels:

area-System.Text.Json, up-for-grabs

Milestone: 7.0.0

@layomia layomia removed the untriaged New issue has not been triaged by the area owner label Sep 28, 2021
@SkiFoD
Copy link
Contributor

SkiFoD commented Oct 13, 2021

@layomia Hey, I would like to work on the issue. I have done some investigations and it seems I need your assistance.

SkiFoD added a commit to SkiFoD/runtime that referenced this issue Oct 13, 2021
@SkiFoD
Copy link
Contributor

SkiFoD commented Oct 14, 2021

@layomia There are cases when a structs implements any enumerable interface. For example public struct MyListStruct : IList .... In these cases we can't use methods like CreateListInfo and etc because of the constraints they have, so the fast path can't be created. What do you think about that?

@layomia
Copy link
Contributor Author

layomia commented Nov 17, 2021

Closing as fast-past methods for underlying types are already being invoked - #60366 (comment).

@layomia layomia closed this as completed Nov 17, 2021
@layomia
Copy link
Contributor Author

layomia commented Nov 17, 2021

@layomia There are cases when a structs implements any enumerable interface. For example public struct MyListStruct : IList .... In these cases we can't use methods like CreateListInfo and etc because of the constraints they have, so the fast path can't be created. What do you think about that?

If we really wanted to eek out the last mile of perf for nullable structs, we would need to add a new method to attach the generated fast-path logic to, e.g. CreateNullableOfTInfo or similar.

@layomia layomia removed the help wanted [up-for-grabs] Good issue for external contributors label Nov 17, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Dec 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants