DEV Community

Cover image for How I reduced clients website loading speed from 10 to 2 sec? Time: 2 hours, Charged: $500
Nikhil Agrawal
Nikhil Agrawal

Posted on

How I reduced clients website loading speed from 10 to 2 sec? Time: 2 hours, Charged: $500

Few days back...

I optimized a client's website loading speed from 10 sec to < 2 sec

Time spent: 2 hours
Charged client: $500

Here are 8 steps I did which You can follow them to optimize website made with any CMS or technologies:

First, why should you make any website faster?

  • ✔️ Decrease bounce rate by 57% (as per study)
  • ✔️ Increases google ranking
  • ✔️ Happy Visitors/Customers

let's check the steps 👇

1/ Analysing website:

➡ Go to http://gtmetrix.com

➡ Enter the URL and hit "Test your site"

➡ In few secs you'll see complete report containing GTmetrix Grade, Performance & structure.

(GT metric report)
GT metric report

➡ In GT metric report scroll down to "Top Issues"

➡ Which will show issues related to JS, CSS, Images, too many requests, page size & more

👉 GTmetrix will show most of the improvements, BUT NOT ALL

➡ Let's resolve issues pointed by GT metric

2/ Image size optimization:

➡ Reduce all image sizes from MB to KB

➡ Go to http://squoosh.app
➡ Upload original images
➡ Download compressed images
➡ Replace in your website

3/ Lazy load images:

➡ Lazy loads defer loading of images until user scrolls near them

➡ Do only if there are lot of images

➡ Just add loading="lazy" in img tags

(check screenshot)

Lazy load images

4/ Caching js & css

➡ Caching assets loads them once & stores them in browser cache

➡ This reduces loading time of subsequent pages

➡ Cache them by adding an asset version

(check screenshot)

Caching js & css

5/ Minify JS & CSS:

➡ Minifying JS & CSS will reduce their size by almost 70%

➡ Go to http://smalldev.tools, search js/css minifier

➡ Minify all js & CSS

PS: keep a backup of non-minified files in case it may be required later

6/ Move JS to end of document:

➡ JS blocks all other resources
➡ This increases "First Contentful Paint" time
➡ Move them to end of HTML document

7/ Brotli compression:

➡ It reduces HTML size by almost 80%

➡ Go to http://giftofspeed.com/gzip-test/ & check if enabled or not

➡ If not, contact hosting to enable it

➡ Or use cloudflare to use this for free

Now we're done with optimization suggested by GTmetrix

➡ Re-test your website & you'll see a good improvement 🤩

➡ but not yet 100% optimized

Let's optimize more...

8/ Database optimization:

Unoptimized DB can reduce speed by a lot

DB optimization can be a big topic, but doing this basic will help

➡ Add indexing to fields used for searching, sorting & table joins (basic)


This is my first post. Hope this post helps!

Comment below for an questions you have.

Connect me on Twitter and LinkedIn.

Top comments (2)

Collapse
 
vulcanwm profile image
Medea

This is really helpful! Thanks!

Collapse
 
heynikhila profile image
Nikhil Agrawal

Thanks Medea!