Web Optimisation Tip: Keep your HTML Size to < 14KB. Know, why!~

Fine tuning website performance

Web Optimisation Tip: Keep your HTML Size to < 14KB. Know, why!~

Let's talk about the central piece of your website, the HTML & how we can make it better.

So as most of you must be aware, as you go type in a url in your browser, the browser will try to find the IP for the given domain & go look in DNS. There are many things which happens in there, but for this post, those are irrelevant & I am just skipping to what I want to tell in here.

So let's skip till the part where browser initiates a HTTP Call. And what's the protocol that HTTP uses underneath, TCP(Transmission Control Protocol). Well correct, up until now at least & will change in HTTP3.

TCP uses a congestion control strategy called "slow start", where it avoids sending more data & gradually increases as more & more packets get acknowledged.

So at first 10 packets are sent and as they get acknowledged, TCP increases to 20, then to 40, 80 & so on...

One TCP packet can be about 1500bytes, out of which 60 bytes are reserved for the headers, that leaves 1460 bytes. So 10 packets would be worth about 14KB(14.25KB actually).

That means browser doesn't have to do any more round-trip for fetching additional HTML data, one trip would suffice. And thus in one round trip browser has got all the HTML it needed & in turn page load time will be faster.

Amazing, isn't it.

via GIPHY


Well, that's all for this article now.

I am Manash & I speak about Javascript, NodeJS, Web Performance, Web Security to name a few. For getting such tips/updates please do follow/connect with me over Linkedin or Twitter

Thanks for reading!