“Patience is a virtue” – an adage that hardly holds when we consider online activities. The page load time of your website is very important. Why?
It decides whether a visitor to your site will explore further, or shall part ways on the first click.
Some statistical facts:
- A 1-second load time delay leads to 11% fewer page views, 16% decrease in customer satisfaction and 7% loss in conversions.
- 44% of customers develop a negative image of the company, if its website load time is poor.
- According to Amazon, there is a 1% increase in revenue for every 100 milliseconds improvement.
Also, studies say, 47% visitors expect the load time to be 2 seconds or less, and if it takes longer than 3 seconds, 57% of your prospects will abandon the site and go elsewhere to serve their needs.
The speed also determines the Google search ranking of your website. Below are provided certain ways that shall help in decreasing the load time of your website.
Ways to decrease load time of your Website
1. Optimize Images : Images should be scaled appropriately, before uploading. We need to understand this: if we have a 1000 X 1000 pixels image, which we have scaled down to 100 X 100 pixels with the help of CSS, the browser still loads the actual size, that is, in this case, 10 times more than necessary.
To avoid this, crop or scale your images before uploading them to your site using various image editing tools. Some of these image optimization tools are :
- Online Image Optimizer
- JPEG &PNG Stripper
Talking of image format, JPEG is the best option. PNG is good too, though not supported by many older browsers.
- For HTML, we can use the PageSpeed Insights Chrome Extension to generate optimized version of your HTML code.
- For CSS, use the YUI Compressor and cssmin.js
3. Enable Compression : Large pages can be compressed by zipping them. Compression reduces the bandwidth of your pages, subsequently reducing HTTP response.
Gzip is one tool often used to achieve this.Since 90% of today’s Internet traffic uses Gzip, it is worth an option. After Gzip Compression, set up your server to enable compression.
- Apache: Use mod_deflate
- Nginx: Use HttpGzipModule
- IIS: Configure HTTP Compression
4. Browser Caching : Temporary storage of data on the visitor’s hard drive will do away with the waiting time visitors undergo every time they visit your site. This can be done using browser caching. However, the duration for which this data is stored depends on your server-side cache configuration. To enable browser caching, you need to edit your HTTP headers to set up expiry times for certain types of files.
This example shows how to configure Apache to serve appropriate headers:
- Find your .htaccess file in the root of your domain. The file is hidden , but FTP clients like FileZilla would help it show up.
- Use notepad or any other basic editor to add following to the .htaccess file.
- Different expiry times could be set depending on your website’s files. Frequently updated files would require an earlier expiry time.
- When you are done, save the file as it is.
More ways shall be explored in the below next set.
Ways To Reduce The Loading Time Of Your Website | Set 2
This article is contributed by Nihar Ranjan Sarkar. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.