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

perf: Change serializer for XrefMap from NewtonsoftJson to System.Text.Json #9872

Merged
merged 3 commits into from
May 28, 2024

Conversation

filzrev
Copy link
Contributor

@filzrev filzrev commented Apr 14, 2024

This PR is recreated instead of #9832.

This PR contains cherry picked commit from above PR.
And resolve conflicts that are occurred at following codes.

  • DownloadFromWebAsync method of XRefMapDownloader.cs
  • Api.verified.cs.

Following review comment is remaining that need to be resolved.
('#9832 (comment))

Can we change Dictionary<string, object> Others -> Dictionary<string, JsonElement> Others if that is the only place using this converter?

Copy link

codecov bot commented Apr 14, 2024

Codecov Report

Attention: Patch coverage is 65.71429% with 24 lines in your changes are missing coverage. Please review.

Project coverage is 78.95%. Comparing base (fe673ec) to head (b86e143).
Report is 126 commits behind head on main.

Files Patch % Lines
...System.Text.Json/ObjectToInferredTypesConverter.cs 34.61% 15 Missing and 2 partials ⚠️
...mon/Json/System.Text.Json/SystemTextJsonUtility.cs 81.81% 5 Missing and 1 partial ⚠️
src/Docfx.Build/XRefMaps/XRefMapDownloader.cs 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9872      +/-   ##
==========================================
+ Coverage   74.31%   78.95%   +4.63%     
==========================================
  Files         536      540       +4     
  Lines       23189    23374     +185     
  Branches     4056     4053       -3     
==========================================
+ Hits        17234    18455    +1221     
+ Misses       4853     3792    -1061     
- Partials     1102     1127      +25     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@filzrev
Copy link
Contributor Author

filzrev commented Apr 15, 2024

Can we change Dictionary<string, object> Others -> Dictionary<string, JsonElement> Others if that is the only place using this converter?

This property is used by YamlDotnet also. so it can't simply changed to JsonElement.


I also tried to create JsonConverter<Dictionary<string, object>> for this type (That similar to JObjectDictionaryToObjectDictionaryConverter)

But it seems not possible to use custom JsonConverter with `[JsonExtensionData] attribute.

Because when using JsonExtensionData.
It can't use custom JsonConverter. (serialization works as expected, but deserialize don't use custom converter)
dotnet/runtime#60560

Copy link
Contributor

@yufeih yufeih left a comment

Choose a reason for hiding this comment

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

Thank you @filzrev !

@yufeih yufeih merged commit bb9268c into dotnet:main May 28, 2024
7 checks passed
@yufeih yufeih added the performance Makes the pull request appear in "Performance" section of the next release note label May 28, 2024
@filzrev filzrev deleted the perf-optimize-json-xrefmap-loading3 branch May 28, 2024 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Makes the pull request appear in "Performance" section of the next release note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants