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

Consider using iframes for rustdoc HTML files #679

Open
jyn514 opened this issue Apr 1, 2020 · 5 comments
Open

Consider using iframes for rustdoc HTML files #679

jyn514 opened this issue Apr 1, 2020 · 5 comments
Labels
S-needs-design Status: There's a problem here, but no obvious solution; or the solution raises other questions

Comments

@jyn514
Copy link
Member

jyn514 commented Apr 1, 2020

One of the things #671 (comment), #668, servo/html5ever#414 show is that the live server's performance is very heavily tied to the html parsing (outside of builds). It would be better to instead serve the rustdoc HTML inside of an iframe, but that would require a lot of UI testing we don't currently have.

Related issues: #595, #167

cc @Mark-Simulacrum, @pietroalbini

@Mark-Simulacrum
Copy link
Member

An alternative to iframes or similar is to instead pre-run HTML parsing on rustdoc output and store the header and body and classes separately, such that we could then template them in quickly.

@jyn514
Copy link
Member Author

jyn514 commented Apr 1, 2020

That doesn't help with the existing HTML content, though. Also it would triple the number of files we store on S3, which would have some overhead.

@Mark-Simulacrum
Copy link
Member

Well, we could store new files as such (which would over time migrate us over to the new format). With regards to S3, there's no reason we can't pack in theory, for example storing the HTML like: u64 length of head, head raw, body raw

@jyn514
Copy link
Member Author

jyn514 commented Apr 1, 2020

Ok, that sounds feasible at least. The other things we would get from inline frames though are

  • less network time since we don't have to download the docs ourselves, only link to the s3 bucket
  • less processing time since we don't have to do string formatting on files up to 45 MB
  • clear separation of rustdoc JS from docs.rs JS (which allows us to make a more strict CSP)

@pietroalbini
Copy link
Member

We should not use iframes:

  • Search engines don't recognize the content inside iframes as part of the website's content. This would reduce docs.rs's visibility in search engines a ton.
  • We can't serve files from S3 directly, S3 downloads from the internet are way more expensive than our CloudFront setup.
  • Providing a good UX when clicking links in iframes is not easy.

If we want to remove parsing, Mark's solution is more feasible.

@jyn514 jyn514 added S-needs-design Status: There's a problem here, but no obvious solution; or the solution raises other questions and removed wishlist labels Jun 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-needs-design Status: There's a problem here, but no obvious solution; or the solution raises other questions
Projects
None yet
Development

No branches or pull requests

3 participants