How we sped up our website with one simple piece of code – Our customers and Google love it.

We’re going to let you in on a secret, ok.. not a secret but something that we think is definitely worth sharing!

Our website is getting old now, we admit it needs a spring clean and it’s in the pipeline don’t worry! But we’re just so busy making websites for other people it’s difficult to sacrifice the time! It’s good to be busy though.

 

Conversion rate drops with slow page loading times

Anyway.. We had recently read about a study by Amazon in short it said this…

Tests at Amazon, also in 2007 revealed similar results: every 100 ms (that’s 1 tenth of a second) increase in page load time of Amazon.com decreased sales by 1%.

Apart from Google penalising slow websites as well..

So based on this and some further research we decided we needed to look into our own websites performance as we were aware it could be better. Previously we had recorded times of our site where the latency and php load time was in excess of 5 seconds!!! Sometimes we were seeing up to 8 seconds in total. We took some averages and the load time ignoring latency was 2.5 seconds on average for the load time of the HTML from PHP alone.

We needed to identify why!

 

Find out where you can speed up your website easily

Knowing our website is old and in need of some TLC and rebuilding we decided to look at easy things we could fix quickly to speed up the site. We had a hunch that it was something to do with our footer template and a piece of PHP that fetched the RSS feed from the blog to display the latest blog post in the footer. To our shock, we realised all along this script was loading the RSS feed and then parsing it with every single page request!! This meant that not only did the PHP have to generate our webpages but it also had to wait on WordPress to produce the RSS feed and respond via HTTP request with the output and THEN PHP would parse the RSS for just 1 result.

We know.. This is Madness…

Madness?, This is the internet

 

Work out a solution! – Add some WD40 to that site.

We now had a good idea this was the main culprit for slowing our site down, but how do we fix it? Well it just so happens it was really easy. We were working on a clients site at the same time that needed simple caching for data being returned by external api’s. So we took a function we had built for that site and adapted it and made it more reproducible.

The solution was a basic implementation of a PHP file based cache system. In short we fetch the RSS feed and store it into a text file serialized and then update it every x number of minutes or hours!

 

The Results

We implemented it and ran a few quick tests.. this is where it gets quite impressive.

We managed to shave the php load time down from 2.5 seconds to 0.5 seconds on average. thats a saving of 2 whole seconds! Ok doesn’t sound like much.

But according to Amazon… 2 seconds is a potential 20% increase in conversion rate and not only that: a lowered hosting bill, improved SEO rankings and happier customers! We have actually seen an increase in conversion rate since and a lowered bounce rate. All from about an extra 20 lines of PHP and a tiny file.

Further more our website is much more stable.

 

Taking it further

We got so excited we tried to implement it elsewhere to see if the benchmark of this caching function was quicker than PHP and MySql processing. Interestingly PHP and MySql in some cases was faster. This means you should test to see if the caching function is worth implementing for different sections of your website.

The great thing is we’ve made the php function versatile and easy to implement quickly.

 

Download the function for FREE

We are so pleased and excited by our findings we want to share the wealth.

Download and implement the PK Cache our Free PHP Cache Function for free.

Let us know what you think and feel free to contribute your ideas.

We do require credit for it’s usage but go wild!

Enjoy speeding up your sites and tweet us your results!

-Stefan

Posted in Internet, News, Tips & Tricks | Tags: , , , | 1 Comment
By |
0 comments

Trackbacks

  1. […] Web Design Edinburgh ← Facebook’s new ‘pay to promote your posts’ feature: what does it mean? How we sped up our website with one simple piece of code – Our customers and Google love it. &… […]

RSS Feed
Keep up to date with our latest posts.

Learn more about making the most of your website, marketing and seo. It takes two seconds to subscribe to our rss feed.
Contact
You can get in contact with us via phone or e-mail, we will get back to you very promptly.

+44 (0)131 344 4522
Subscribe!

Join our mailing list to find out about our free giveaways and tutorials. It's free.

Copyright © 2005 - 2017 Pretty Klicks Ltd (prettyklicks.com)