markjaquith / feedback

Ask @markjaquith anything!
42 stars 4 forks source link

How to speed up the usage of static "Google" resources? #24

Closed zachary-russell closed 10 years ago

zachary-russell commented 10 years ago

Hello Mark,

I think it's really cool that you're doing this feedback experiment. I'm working on a site (though this really could apply to any WordPress site) wptemple.com, i'm in the middle of redesigning it using a Genesis child-theme.

This site loads relatively quickly, it's hosted on WP Engine with a CDN and i've purposefully minimized requests. The one thing i'm seeing across this site, is that the response time from Google for thinks like Analytics, Adsense (there are a bunch of requests from them) and web fonts take more time to load than anything else. I've read your articles on fragment caching as well as a tweet you sent out on WPTV, which is what got me thinking about this issue, though I don't know if fragment caching is the solution. Is there any way to do something like cache the responses for these requests and if there is, is it ideal?

Thanks, I really appreciate it! -Zach

markjaquith commented 10 years ago

There is no way to avoid the external calls or Analytics and Adsense, but you can make sure you're using the "asynchronous" version of both, which should minimize its impact on your page's load.

Web fonts are tough. They require some investigation, and possibly some hard decisions about the design of your site. First, make sure that you're not loading any font weights/styles that you're not using. For example, if you're not using the bold-italic version of a font, don't load it! That could save you 100KB right there. Once you're sure that you're not loading anything you're not using, ask yourself if you need to be using as many fonts (and style/weight variations) as you are. Fonts are huge binary files. Look at their percentage impact on the page size vs their importance to your page's design. Lastly, check to see if you're including full charactersets when you might only be using normal Latin characters. Do you really need Russian and Japanese characters for the font you chose? This depends on your site. Tools like Google Fonts and Typekit let you choose versions of the fonts with only common characters loaded. This can trim the size of the files substantially. Next, if you're NOT using a font service, and are loading files manually, consider that these services do a lot of optimization for you, like serving the right charactersets and file types to people depending on their browser language and rendering engine. And also that a visitor might already have a popular font in their cache (especially when using Google Fonts).

Make sure you take a bunch of measurements before you start all of this, so you know how much progress you got for your efforts!

zachary-russell commented 10 years ago

Thanks @markjaquith, I appreciate your response!