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

pref: Optimize xrefmap download performance #9637

Merged
merged 1 commit into from
Jan 24, 2024

Conversation

filzrev
Copy link
Contributor

@filzrev filzrev commented Jan 23, 2024

This PR is intended to resolve #9558

What's included in this PR

  • Add settings to use HTTP Compression (if available)
  • Change HttpClient's timeout to 30 minutes (Default: 100 seconds)
  • Change StreamReader's buffer size to 80KB (Default: 1024 byte)
    • 80KB is default buffer size that used by Stream::CopyTo.

What's tested

I've manually tested xrefmap download with following configuration.

  "build": {
    "xref": [
      "https://learn.microsoft.com/en-us/dotnet/.xrefmap.json"
    ]
  }

And confirmed server returns following HTTP Response headers. And download size is reduced. (316MB -> 16MB)

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 15978441
Content-Encoding: gzip

TODO Tasks
I'll create another PR later relating #9558.

  • Add special deserialization code path for JSON file.
    (Because YamlDotNet based JsonDeserializer is 5x slower than System.Text.Json based deserialization)
  • Add support for loading xrefmap compressed by gzip (xrefmap.json.gz) from local disk.

@filzrev filzrev changed the title pref: Optimize xrefmap download perforamance pref: Optimize xrefmap download performance Jan 23, 2024
Copy link

codecov bot commented Jan 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (ad6db16) 74.31% compared to head (7e13411) 74.30%.
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9637      +/-   ##
==========================================
- Coverage   74.31%   74.30%   -0.01%     
==========================================
  Files         536      536              
  Lines       23173    23177       +4     
  Branches     4054     4054              
==========================================
+ Hits        17220    17221       +1     
- Misses       4851     4853       +2     
- Partials     1102     1103       +1     

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

@yufeih yufeih added the performance Makes the pull request appear in "Performance" section of the next release note label Jan 24, 2024
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.

Looks great! Thank you @filzrev

@yufeih yufeih merged commit 658be00 into dotnet:main Jan 24, 2024
8 checks passed
@filzrev filzrev deleted the chore-optimize-xcrefmap-download branch April 1, 2024 05:03
p-kostov pushed a commit to ErpNetDocs/docfx that referenced this pull request Jun 28, 2024
pref: optimize xrefmap download perforamance
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.

[Feature Request] Download xrefmap.json file on docfx build is significantly slower
2 participants