-
Notifications
You must be signed in to change notification settings - Fork 198
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
Greatly reduce page size #2218
base: master
Are you sure you want to change the base?
Greatly reduce page size #2218
Conversation
Does whitespace impact the parser speed much? I assume this will make very little transfer size difference post-compression. |
Isn't the parsing done once when we start the server and never again normally? |
I mean the web browser parsing the response, since that's the only thing I could see this really impacting. (If we do want to reduce the page size, rather than having to write minified templates I would consider just running every request through a middleware using something like |
I wonder about the data transfer size too. Even though it's compressed, if it's more than 1% diff, considering the traffic we have, I think it's still worth it. |
I lean towards what @Nemo157 said here: if we want to reduce page-size, a middleware with a minimizer would be the better approach, because it would also minify the rustdoc html. But: I could imagine even with a minimizer, the size impact (compressed) is negligible, same as the impact on parsing speed in a browser. And this is coming with an odd (?) style in our templates, which will be difficult to maintain with future changes coming from contributors. That being said, this doesn't hurt. When I'm back from my short trip I'll have a look & will test in detail. |
gzipped transfer sizes:
(minify-html gets -23%, -30%, -29% respectively in the uncompressed html sizes) |
So with just my changes it's already between 4% and 8% reduction. However I'm very curious about what |
I downloaded the Looking at the diff the only structural differences are: removal of comments inside the font-awesome svgs and removal of The other non-structural difference that probably accounts for a lot is removal of quotes around attributes that don't need them. |
That's something I was wondering about: do we need to put the license comments in all HTML pages? Otherwise we could put them into the CSS or keep them as jinja comments. |
@Nemo157 @GuillaumeGomez what are both of your thoughts on this? |
About what exactly? I checked So in short: I'm personally in favour for merging it but I won't push for it. ;) |
What part is invalid? In my tests I was using |
It was merging together some attributes it shouldn't, modified |
Hi @GuillaumeGomez, maintainer of minify-html here. If you have any issues or feedback regarding the minifier I'd be happy to look into them. As @Nemo157 mentioned the DOCTYPE isn't minified in that way with the |
This PR at least has to be rebased. Generally I'm still not sure about the impact when we gzip everything anyways, even between cloudfront & our webserver |
We have a not great handling of whitespace characters in our templates. The fix doesn't look great either, however the result is pretty nice. Here are some numbers: