Chapter 5. Testing and Optimizing for Performance

Throughout the course of this book, we've explored some of the essentials of responsive web design, using HTML5 and CSS3, and learned how to begin to modify our code to make content responsive across different devices.

We should keep in mind that building just a responsive website is not enough—we must also test and optimize content to work as efficiently as possible across different devices. If pages on our site are slow to load, then this will clearly be a concern. Throughout the course of this chapter, we will look at some of the tips and tricks we can use to begin to ensure that our sites are sufficiently responsive and content loads quickly.

In this chapter, we will cover the following topics:

  • Exploring why pages load slowly
  • Optimizing the performance of our sites
  • Measuring site performance
  • Testing for cross-browser compatibility
  • Exploring best practices

Curious? Let's get started!

Understanding the importance of speed

The advent of using different devices that can access the Internet means speed is critical—the time it takes to download content from hosting servers and how quickly the user can interact with the site are key to the success of any site.

Why it is important to focus on the performance of our website on the mobile devices or those devices with lesser screen resolution? There are several reasons for this, they include the following:

  • Nearly 80 percent of Internet users own a smartphone
  • Around 90 percent of users go online through a mobile device, with 48% of users using search engines to research new products
  • Approximately 72 percent of users abandon a website if the loading time is more than 5–6 seconds
  • Mobile digital media time is now significantly higher compared to desktop use

If we do not consider statistics such as these, then we may go ahead and construct our site, but end up with a customer losing both income and market share, if we have not fully considered the extent of where our site should work. Coupled with this is the question of performance; if our site is slow, then this will put customers off and contribute to lost sales.

A study performed by San Francisco-based Kissmetrics shows that mobile users wait between 6–10 seconds before they close the website and lose faith in it. At the same time, tests performed by Guy Podjarny for the Mediaqueri.es website (http://mediaqueri.es) indicate that we're frequently downloading the same content for both large and small screens; this is entirely unnecessary when, with some simple changes, we can vary content to better suit desktop PCs or mobile devices!

So, what can we do? Well, before we start exploring where to make changes, let's take a look at some of the reasons why sites run slowly.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset