10 things you can do to speed up your site
According to Yahoo, 80% of a Web page’s load time is spent downloading the different pieces-parts of the page: images, stylesheets, scripts, Flash, etc. An HTTP request is made for each one of these elements, so the more on-page components, the longer it takes for the page to render.
That being the case, the quickest way to improve site speed is to simplify your design.
Always remember, when it comes to your website, leaner is better.
Pro Tip: Start a campaign to reduce the number of components on each page. By doing this, you reduce the number of HTTP requests needed to make the page render—and you’ll significantly improve site performance.
Your target is a server response time of less than 200ms (milliseconds). And if you follow the tips in this article, you’re well on your way to achieving this.
Google recommends using a web application monitoring solution and checking for bottlenecks in performance.
Pro Tip: Read this report by Singlehop, Critical Ecommerce Infrastructure Needs, to learn nine things you need to focus on to keep your site performing well.
Then tap into these resources:
Large pages (which is what you could have if you’re creating high-quality content) are often 100kb and more. As a result, they’re bulky and slow to download. The best way to speed their load time is to zip them—a technique called compression.
Compression reduces the bandwidth of your pages, thereby reducing HTTP response. You do this with a tool called Gzip.
Most web servers can compress files in Gzip format before sending them for download, either by calling a third-party module or using built-in routines. According to Yahoo, this can reduce download time by about 70%.
And since 90% of today’s Internet traffic travels through browsers that support Gzip, it’s a great option for speeding up your site.
Pro Tip: Read this article for more details on Gzip compression. Then set up your server to enable compression:
When you visit a website, the elements on the page you visit are stored on your hard drive in a cache, or temporary storage, so the next time you visit the site, your browser can load the page without having to send another HTTP request to the server.
Here’s how Tenni Theurer, formerly of Yahoo, explains it…
Once the page has been loaded and the different components stored in the user’s cache, only a few components needs to be downloaded for subsequent visits.
In Theurer’s test, that was just three components and .9 seconds, which shaved nearly 2 seconds off the load time.
Theurer says that 40-60% of daily visitors to your site come in with an empty cache, so it’s critical that you make your page fast for these first-time visitors. But you also need to enable caching to shave time off subsequent visits.
Pro Tip: Read this article to learn four methods for enabling caching.
Static resources should have a cache lifetime of at least a week. For third-party resources like ads or widgets, they should have a cache lifetime of at least one day.
For all cacheable resources (JS and CSS files, image files, media files, PDFs, etc.), set Expires to a minimum of one week, and preferably up to one year in the future. Don’t set it to more than one year in the future because that violates the RFC guidelines.
WYSIWYG resources make it easy to build a Web page, but they sometimes create messy code—and that can slow your website considerably.
Since every unnecessary piece of code adds to the size of your page, it’s important that you eliminate extra spaces, line breaks, and indentation in your code so your pages are as lean as possible.
It also helps to minify your code. Here’s Google’s recommendation:
With images, you need to focus on three things: size, format and the src attribute.
Oversized images take longer to load, so it’s important that you keep your images as small as possible. Use image editing tools to:
Once you’ve got the size and format right, make sure the code is right too. In particular, avoid empty image src codes.
In HTML, the code for an image includes this:
When there’s no source in the quotation marks, the browser makes a request to the directory of the page or to the actual page itself. This can add unnecessary traffic to your servers and even corrupt user data.
Pro Tip: Take time to re-size your images before uploading them. And always include the src attribute with a valid URL.
To ensure your images load quickly, consider adding the WP Smush.it plugin to your website.
CSS holds the style requirements for your page. Generally, your website accesses this information in one of two ways: in an external file, which loads before your page renders, and inline, which is inserted in the HTML document itself.
The external CSS is loaded in the head of your HTML with code that looks something like this:
Inline CSS is nested in your page’s HTML and looks like this:
In general, an external style sheet is preferable, because it reduces the size of your code and creates fewer code duplications.
Pro Tip: When setting up your styles, only use one external CSS stylesheet since additional stylesheets increase HTTP requests. Here are a two resources that can help:
Avoid including CSS in HTML code, such as divs or your headings (like the inline CSS pictured above). You get cleaner coding if you put all CSS in your external stylesheet.
Having just recommended that you use only one CSS stylesheet and no inline CSS, there is one caveat you need to consider. You can improve user experience by having your above-the-fold (top of the page) load faster—even if the rest of the page takes a few seconds to load.
Pro Tip: Consider splitting your CSS into two parts: a short inline part that styles above-the-fold elements, and an external part that can be deferred.
Too many plugins slow your site, create security issues, and often cause crashes and other technical difficulties.
Pro Tip: Deactivate and delete any unnecessary plugins. Then weed out any plugins that slow your site speed.
Try selectively disabling plugins, then measuring server performance. This way you can identify any plugins that harm your site speed.
Redirects create additional HTTP requests and increase load time. So you want to keep them to a minimum.
If you’ve created a responsive website, more than likely, you have redirects in place to take mobile users from your main website to the responsive version.
Pro Tip: Google recommends these two actions to make sure a responsive redirect doesn’t slow your site:
Sound too technical? Don’t worry. This post by VerveSearch helps you navigate your switch to a mobile-friendly website without compromising speed.
Some of these tips are easy to implement, but a few are advanced tactics that can be intimidating if you aren’t technically inclined.
If that’s the case, you might want to get help. Here are a few resources I can recommend:
Now it’s your turn. Have you come up with a unique way to speed up your website? Share your tips.