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

Compress html documents when sending them to the user #360

Closed
bendem opened this issue May 31, 2019 · 8 comments
Closed

Compress html documents when sending them to the user #360

bendem opened this issue May 31, 2019 · 8 comments

Comments

@bendem
Copy link

bendem commented May 31, 2019

Html documents served by docs.rs are not compressed resulting in large bandwidth waste on pages for complex types.

See for example the iterator page as discussed here: rust-lang/rust#55900 (comment)

@GuillaumeGomez
Copy link
Member

I wondered for a long time if we should handle compression directly inside rustdoc. That could be a good time to talk about it as well...

@pickfire
Copy link
Contributor

pickfire commented Dec 8, 2019

If the docs are compressed locally, rustup doc --std probably needs some changes such as starting up a server instead of just opening the file, I think it affects search as well.

@GuillaumeGomez
Copy link
Member

It would indeed. Which is why we never did.

@pickfire
Copy link
Contributor

pickfire commented Dec 9, 2019

@GuillaumeGomez The current possible solution may be minifying the html resource which can probably shave like ~5% off while keeping the same output without much changes. What do you think?

Of course, compared to compressing which could save like 90% off it's small. Just compressing individual files already get 10% of original size, think compressing after archiving into tarball.

.rw-r--r-- 358k pickfire 25 Dec 00:00 iterator.rs.html
.rw-r--r--  26k pickfire 25 Dec 00:00 iterator.rs.html.bz2
.rw-r--r--  43k pickfire 25 Dec 00:00 iterator.rs.html.gz
.rw-r--r--  25k pickfire 25 Dec 00:00 iterator.rs.html.xz
.rw-r--r--  36k pickfire 25 Dec 00:00 iterator.rs.html.zst

@GuillaumeGomez
Copy link
Member

If the web browsers can still work with local compressed files, then I'm totally going to add it.

@jyn514 jyn514 changed the title Compress html documents Compress html documents when sending them to the user Apr 17, 2021
@syphar
Copy link
Member

syphar commented Jan 11, 2023

NGINX & CloudFront are serving compressed content when the browser supports it.

So I assume this issue is solved.

Please feel free to reopen if not.

@syphar syphar closed this as completed Jan 11, 2023
@pickfire
Copy link
Contributor

pickfire commented Jan 12, 2023

The local docs are not compressed, it took up 635 MB for the current stable, half the size of the whole toolchain (1.2 GB). I think we can reopen this, but one issue is browser does not work with locally compressed files.

@syphar
Copy link
Member

syphar commented Jan 12, 2023

This repo here is purely about https://docs.rs .

"local docs" sounds like this is about rustdoc itself (when it's about crate docs), which lives in https://github.com/rust-lang/rust , or the std docs, which live there too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants