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

[Feature Request] Enable faster UID search when using xrefmap.json for .NET types #9821

Open
filzrev opened this issue Mar 28, 2024 · 2 comments
Labels
xref Cross reference another document using unique IDs

Comments

@filzrev
Copy link
Contributor

filzrev commented Mar 28, 2024

Is your feature request related to a problem? Please describe.

When using xrefmap for .NET types.
It's recommended to use xrefmap file that is located at https://github.com/dotnet/docfx/raw/main/.xrefmap.json. (By #9659.)

Problems

This file contains 312235 reference items.
But the sorted: true property is not set.
So when searching for specific uid. It requires to execute liner search.

Describe the solution you'd like

As far as I've tested.
These items are already sorted by UID with InvariantCulture order.
So it can use faster binary search. if sorted: true property is set.

Additional Information
Alternatively. It might possible to use following xrefmap files.
Is these URLs are still supported?

  1. https://learn.microsoft.com/en-us/dotnet/.xrefmap.json (316 MB)
  2. https://learn.microsoft.com/en-us/dotnet/xrefmap.yml (283 MB)
  • This yml file set sorted: true by default
@yufeih
Copy link
Contributor

yufeih commented Mar 28, 2024

Sounds like BasicXrefMapReader should internally turn the map it into a dictionary to speed up lookup.

@yufeih yufeih added the xref Cross reference another document using unique IDs label Mar 28, 2024
@filzrev
Copy link
Contributor Author

filzrev commented Mar 29, 2024

On my environment ToDictionary() takes about 125[ms].
And when getting last element. it takes following times.

Liner search 56 [ms]
Binary search 11 [ms]

So it might make sense to create a UID lookup table. (Although it will increase memory footprint)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
xref Cross reference another document using unique IDs
Projects
None yet
Development

No branches or pull requests

2 participants