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

Rustdoc JSON 2023 Roadmap #106697

Open
13 tasks
aDotInTheVoid opened this issue Jan 11, 2023 · 0 comments
Open
13 tasks

Rustdoc JSON 2023 Roadmap #106697

aDotInTheVoid opened this issue Jan 11, 2023 · 0 comments
Labels
A-rustdoc-json Area: Rustdoc JSON backend T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@aDotInTheVoid
Copy link
Member

aDotInTheVoid commented Jan 11, 2023

Foreign ID Lookup

This need's it's own issue at some point, but for the zulip chat is the best resource.

The problem we want to solve is that if I have an Id from one crate's json, but the Id is for a foreign type, then it won't be present in index, only paths. If you want to see the Item, you need to find the json for the crate that this Id is from. The problem is that in this JSON you need to use a different ID. To find the ID in the crate the item is local to, you need to find the path for the item from paths, and then look that up the the json for the crate the item's from.

This is cumbersome, slow, and unreliable 1.

Idealy you should be able to just use the Id from one JSON in another. I'm not sure if this is possible, or if we'll need some translation scheme, potentially spiting Id's into two fields (crate id, and item id). How exactly this will work needs further design work.

Correctness.

Rustdoc JSON should never emit wrong, or invalid data (duh). There is still work to do on this, in particular:

Once these are fixed, we should:

  • Do a crater run with jsondoclint on the output running automaticly.

Performance

Rustdoc JSON has had essentially no performance work done to it 2. Theirs probably alot of low hanging fruit.
The first thing to make this feasable is

Once this lands and we can use @ bors try @ rust-timer queue, we can actually make some changes. It's hard to know what actually matters without data, but some ideas to explore:

  • Don't allocate a String for each Id
  • Don't use the default hasher when building index, but use one of the good ones without HashDos migrations (probably rustc's fxhash)
  • Be more clever about cloning items before inserting them into the index, by using the entry api
  • Avoid allocating a PathBuf in Span.

Internal Improvements

  • Think about how to avoid hitting the recursion limit for more compex types (eg)
  • Ensure we don't lose a FORMAT_VERSION bump to git race conditions. #94591
  • Switch away from jsonpath_lib for jsondocck, as it can't do complex predicated, which is annoyed (issue)
  • Add suport for using variable to create jsonpath query in jsondocck. Would be usefull for $.index[$$some_id$$].inner.something, although the syntax for interpolation here needs work.
  • Writeup docs for the testing settup, #100515

Footnotes

  1. Especialy when the path isn't present in the public docs.

  2. Except for fixing an issue where a syscall was being done for every single key, punctuation and value in JSON.

@aDotInTheVoid aDotInTheVoid added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-rustdoc-json Area: Rustdoc JSON backend labels Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-json Area: Rustdoc JSON backend T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

1 participant