-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Improve docs rendering performance by addressing PageSpeed Insights issues #20962
Comments
For triage/future comparison purposes, the current state is:
cc #20961 |
Note the "how to fix" links on the PageSpeed site for each issue; clicking on them will provide more information, like a list of all static resources on the page that have been detected as not currently using browser caching etc. That extra debug info is what I've personally found to be a goldmine from PageSpeed. |
re-tagging as infrastructure and rustbook, as those are the two things that would need changed for this. |
Do we have an in-tree way to minify CSS already? Hm, since this is part of rustbook, I guess the minifier needs to be in rustbook. Do these issues only apply to the book or to rustdoc as well? If this is a rustbook issue maybe it's not even worth fixing. Just wait to convert everything to mdbook. |
I don't believe so. On Jun 27, 2016, 18:08 -0400, Brian [email protected], wrote:
|
Removing the |
While Rustdoc itself can address "Eliminate render-blocking JavaScript and CSS in above-the-fold content" and "Minify CSS", "Leverage browser caching" and "Enable compression" depend on the http server's configuration (CloudFront and S3?). |
…Gomez Unblock font loading in rustdoc.css rustdoc's font loading defaults to "auto", so browsers may block render. But rustdoc's case prefers a faster TTI for scrolling, this means the strictest font-display in use should be "swap". rustdoc's fonts do provide notable legibility improvements but first-time users will have little trouble reading without. This means "optional" is preferred. The one exception is Source Serif Pro: it's a big difference for body text, so "fallback" is preferred over "optional" to cause a (tiny) block. This follows up on (but does not resolve) rust-lang#20962, taking PageSpeed Insight's rec fairly directly. Supporting reading material: https://drafts.csswg.org/css-fonts-4/#font-display-desc
…Gomez Unblock font loading in rustdoc.css rustdoc's font loading defaults to "auto", so browsers may block render. But rustdoc's case prefers a faster TTI for scrolling, this means the strictest font-display in use should be "swap". rustdoc's fonts do provide notable legibility improvements but first-time users will have little trouble reading without. This means "optional" is preferred. The one exception is Source Serif Pro: it's a big difference for body text, so "fallback" is preferred over "optional" to cause a (tiny) block. This follows up on (but does not resolve) rust-lang#20962, taking PageSpeed Insight's rec fairly directly. Supporting reading material: https://drafts.csswg.org/css-fonts-4/#font-display-desc
I have been poking around improvements to rustdoc for this. First, for the ownership page: long since moved, but checking the stats for Understanding Ownership: What is Ownership? gives us an overall Mobile 73, Desktop 95. So, better, even though it's a much more complex page now! Nice. It still recommends "Eliminate render-blocking resources" and "Serve static assets with an efficient cache policy" though. But I have been focused on "Core Web Vitals" have been added to PageSpeed Insights.
Field DataThis is gathered from recent visits that Chrome's telemetry reports, basically. Mobile
Desktop
Lab DataIt should be noted that Lab Data and most diagnostics are not consistent between runs of PageSpeed Insights. I ran it a few times and took a median.
As we can see, CLS mostly exists on screens that are bigger, FID is low, TBT is not great, but our FCP is good and our LCP could use improvement. Opportunities & Diagnostics
|
Mostly rustdoc is about typography. Improving font loading may be the biggest win in actual performance (I notice a long block when loading a page in actual usage, which goes away when I twiddle with the CSS to use The Cache-Control headers are still needed on the server configuration side. |
I recommend this recent article that goes into great depth on the fastest way to load external fonts from Google Fonts (which I believe the rust docs use): https://csswizardry.com/2020/05/the-fastest-google-fonts/ |
It does not. The article is an OK summary in spite of that but there are other issues which I have discovered in actually implementing such changes which are long and off-topic. |
Results from PageSpeed.
The easy ones are setting up cache expiration times for the font & css files and minifying the CSS. Eliminating render-blocking JavaScript and CSS in above-the-fold content is a bit harder, but shouldn't be too much work for a static site.
The text was updated successfully, but these errors were encountered: