How to increase the website performance?

Increase Website Performance

Ever encountered a slow-loading website something with a very slow website performance? Sometimes while surfing the web, we come across a very slow loading page that might take 20 seconds to fully load. And eventually, skip the page and continue browsing for other pages.

This has a serious impact on the business if their website loads too slowly. Websites that load faster have better user retention and add up to the bookmark lists of users quickly.

Various studies depict that slower websites mostly eCommerce lose their business vastly within a delay of just one second in load time.

Even Google keeps track of load speed indicators in order to deliver the best user experience.

Tools to measure Website Performance / Speed

A site cannot be made super fast without understanding the real cause of its slowness. With these tools, we can understand our website in a better way.

webpage

GT Metrix

Working as a developer, I always try to deliver a fast-loading site that never lets the users be disappointed. It is my duty to make the website performance better. And the first thing that comes to my mind is to test the speed in GT Metrix. It has some advanced features like location and suggestions for improving performance. Also, it allows testing the site from various locations, devices, and screen resolutions. I guess we get all the required data on the low speed, at one shot.

Google Page Speed Insights

A product of Google to help developers in testing the site speed on mobile and desktop. Depending on the value in the report, speed can be improved following the suggestions.

Google Search Console

Another product from Google. It doesn’t deliver the speed of your website but scans the entire website and lists the URL that can be optimized for better results.

How to improve website performance/speed?

A simple solution comes in the following few steps to follow.

VPS hosting service and CDN

A dedicated server is expensive for a website to host while a shared hosting server isn’t fully reliable when it comes to delivering full speed to your hosted website. So the best possible solution is to use a Virtual Private Server (VPS). This creates a layer on the server OS handing over complete control over the machine. In this way, the resources aren’t shared among the users and you can enjoy customizing the server as you need it.

Content Delivery Network is a service provides that delivers website assets like images, JSON files, HTML, CSS, and Javascript files from the nearest server available. This reduces the waiting time while requesting the site. The best available CDN provider is Cloudfare while we have other options too, to explore.

CSS/Javascript minification and Defer Javascript Loading

Minification is to reduce the time to load the CSS and Javascript files by the browser. This is mostly done by removing spaces, deleting comments, and removing any unnecessary code. This can be easily done by various plugins and tools.

https://cssminifier.com/
https://javascript-minifier.com/

GZip compression is a technique that helps minification.

When loading the website, first we need to display the necessary content that the user comes to the website. So in order to make this successful, javascript can be loaded after the content is fully downloaded. For this, we can use the defer attribute in the script. A brief guide on using defer attribute: https://www.w3schools.com/TAGS/att_defer.asp

Optimize Images

The best way to contribute to webpage speed is to decrease the size of images that are used on the page. We have many tools to optimize the image size and dimensions to best fit the web requirements. Image format also plays a major role in loading. So using a simpler format like jpg/jpeg loads the image quickly and easily thus reducing the site load time.

3rd party scripts

The scripts we use for various functionalities like Google Adsense, Google Analytics, etc help us in numerous ways but they increase the load time as the script has to be downloaded fully in order to use the additional feature on the site. So make sure the added code is necessary and fully optimized. Just remove everything that’s been unused.

Browser Cache and Lazy loading

Browser caching helps in loading the site very quickly by creating a local copy of the site in the browser. Every time a user requests the website, it loads the site from the local cache which improves the load time drastically. Browser caching can be enabled by adding the following code in the .htaccess file.

<IfModule mod_expires.c>
# Turn on the module.
ExpiresActive on
# Set the default expiry times.
ExpiresDefault “access plus 2 days”
ExpiresByType image/jpg “access plus 1 month”
ExpiresByType image/svg+xml “access 1 month”
ExpiresByType image/gif “access plus 1 month”
ExpiresByType image/jpeg “access plus 1 month”
ExpiresByType image/png “access plus 1 month”
ExpiresByType text/css “access plus 1 month”
ExpiresByType text/javascript “access plus 1 month”
ExpiresByType application/javascript “access plus 1 month”
ExpiresByType application/x-shockwave-flash “access plus 1 month”
ExpiresByType image/ico “access plus 1 month”
ExpiresByType image/x-icon “access plus 1 month”
ExpiresByType text/html “access plus 600 seconds”
</IfModule>

Lazy loading helps in loading the images for first-time visitors. Instead of loading all the images, lazy loading loads the images that first interact with the user. It can be implemented just by using the following syntax:

<img src=”image.jpg” loading=”lazy” alt=”image” />

Final word

There are many ways to improve the site speed and these are the few that most developers follow frequently.

There are other techniques like Prefetching that load a few assets ahead of time in the browser. By following the above-listed techniques, your website should load real fast.

If you find these tricks useful, please let us know in the comments and if you have any other useful methods to improve the speed of the website, please share with us.

Additional Read: Know the basics of Cryptocurrency

  • November 30, 2021
  • 2