Nothing drives users crazy like a slow-loading website. Back in the day, we happily waited 30 seconds for pages to load over a 56K modem. Now, we expect pages to load immediately, and we get frustrated and click away when they don’t.
There are a number of ways to optimize sites for speed; some involve server side issues and client side code. Here are four methods that you can and should be implementing on any site you develop.
One way to optimize speed is to get resources from your server to browsers quickly. One way to do this is to crop, resize, and compress (encode) images appropriately. For example, if you’re using a photo from a 6-megapixel camera as a thumbnail, make sure you’re not transferring that large image across the Net just to have a fraction of it show on your site.
Instead, use tools like Photoshop, Gimp, or even Paint.NET to crop out components you don’t want in the photo, resize the image, and use appropriate compression.
If your image is a photo, we recommend JPG file formats. Logos and graphics work best as PNGs. And small icons and limited-color objects might be best as GIFs.
Reduce requests to the server
You can also increase speed by combining logos and icons into one larger image—a sprite map—that you show portions of as needed.
Think of loading a webpage like ordering a printer online. Your printer comes in the mail, and it’s only then you realize you need a special cable. You order the cable, then realize you need paper. And then ink.
These tiny shipments are similar to HTTP requests. Most browsers can “order” two things at a time from a web server, but the more items are requested, the longer the page takes to load.
That’s where sprite maps come in. Using a sprite map is like getting an entire kit of supplies for your printer in one package, instead of in multiple tiny shipments. With sprite maps, you create one image that contains all of your logos, icons, and backgrounds. Then, with CSS, you use properties like background-position to restrict which parts of the image show to users at any given time.
This reduces the number of requests to the server and in turn, speeds loading time.
Avoid inline styles and consolidate CSS
Imagine reading a story about a boat. Every time the author mentions the boat, they call it “the rickety white boat from Nantucket.” Using that phrase over and over would waste space and slow readability.
That’s what developers are doing when they abuse inline styles. Describing every “p” tag in your document as having a specific margin and padding wastes time when the web browser is trying to download the site. Using CSS in external files reduces this bloat. Plus, CSS is cacheable, significantly reducing load time on subsequent page requests.
Cache is king
One of the best ways to create an incredibly fast browsing experience for returning users is to cache your content on their computer. One of the easiest ways to do this is to have your web host install mod_speed, from Google. It’s an Apache module that provides recommended cache lifetimes depending on file type.
To learn more, you can check out tools like YSlow from Yahoo, that give recommendations on caching content, where your holdups are, and even provide tips on whether you are requiring too many HTTP requests.
Speed = less server load Users will definitely be happier when you speed up your site. And there’s an added bonus: the faster you deliver content, the faster users will find what they need and leave your site. That means less drain on your servers, giving you the ability to serve more customers with less hardware.
When you think about web design what do you think of? Perhaps functionality comes to mind. You want something that works. You want a site that will give your views the right information to drive them to become a consumer. With web design the way a website functions and the information shown is so important. […]