Default Banner

Improving Website's Performance - Part 2

Improving Website's Performance - Part 2

A technical approach at increasing and attracting traffic to your website is to give the end user a great experience and this can be achieved by increasing the overall performance of your website.

In the first part of this article1 we had a look at minification of resources, minimising HTTP requests and optimisation of images; and in this second part of the article we will look further at other implementations that can be done to make the website load faster.

Implement caching

Thanks to modern days’ browsers, most of the website's external files, such as CSS, JS and images, can be cached and thus stored on the user's machine upon download to be then used again when the user visits the website another time. If the user is visiting the website for the first time, all the content of the website will be downloaded but if caching is enabled it will be stored. This is very effective and it increases the loading and response time of the website. Just imagine, every time you’re hitting that "Back" button most of the data is already downloaded and will be fetched from the storage of your machine instead of getting packets of data from the web. Just be careful to not overuse this feature. Any content that will feature data that will change often must not be cached in order to provide the user with the latest information. Another possibility is to have shorter expiry dates to force the web browser to refresh the stored data and fetch the latest, hence the correct information. A good trick to ensure that the web browser is requesting the latest files from the server and not from the user's storage is to change the file name.

Server side improvements

Most of the improvements we have mentioned so far are all front end implementations but if your website relies on retrieving chunks of data from a server then you might want to consider implementing server side, source code and database improvements. Consider reviewing your code and don’t be afraid to make amendments to refactor your code as to make it run faster and more efficiently, which will eventually

improve the website's response time. Tighten loops when possible by moving unnecessary logic outside of the loop. If a loop has an extensive number of iterations and the required data was retrieved after just a few iterations, then break the loop and avoid making unnecessary iterations. Additionally, if a database connection is being established on every loop iteration to retrieve data, then, if possible, make the database connection outside the loop to minimise the database calls requests and retrieve the data before processing the loop. Other ways to write efficient code is to declare variable types if the data type is known. Avoid any unnecessary variable conversions and once the processing is complete set the variables which aren't going to be used again to null, particularly if the variables' type are of complex types and hold large amounts of data. Lastly, before writing the code, analyse the flows and consider implementing appropriate design. You would be surprised what a difference it makes in the long run to actually sit down and design the logic on a piece of paper before implementing it on your computer.

Performance tools

To test the improvements or simply just to get an idea of the current rating of your website there are a few tools you can make use of. These tools analyse websites and grade features which are related to the website's performance such as, minification of resources, the amount of HTTP request and image sizes being loaded, in other words the implementations that we have been discussing above and in the previous article. On top of that they check the website's response time from different geographical locations and different web browsers, some of them also checking for mobile responsiveness. There is quite a selection of different tools you can use, some of them are online tools which test and produce their results via their website whereas others have to be downloaded and installed on your computer or web browser. Some of the most popular are Pingdom, KeyCDN, Website Speed Test and GTmetrix, the last two being completely free to use. Worth mentioning is that GTmetrix makes use of Yahoo's YSlow and Google's PageSpeed, two reliable tools that perform the same job however GTmetrix takes both results, compares them and produces the final rating.

Developing a website which looks nice and attractive is quite important if you would like to have a constant figure of visitors, because at the end of the day design is considered as a huge factor in web development. However, having said that, it is important to give the visitor a website that has a quick response time and an overall better user experience. When developing a website, it is important to keep in mind that the website should be running smoothly and implementing the features we have discussed would surely help to achieve this result.


1. Improving Website's Performance - Part 1 of this article was published on 1st April 2017