DEV Community

Discussion on: I'm Addy Osmani, Ask Me Anything!

Collapse
 
ben profile image
Ben Halpern

Are there any specific thresholds in terms of sending a certain number of KBs or MBs where the user experience starts to suffer most? And would that number be considerably different for areas well-served by fast Internet vs underserved areas?

I operate under "less is better" paying some attention to possible packet-specific thresholds, but I can't say I'm all that certain about any of my ways and any insight in this regard would be awesome.

Collapse
 
addyosmani profile image
Addy Osmani

I usually try to walk back from my goals when it comes to performance budgets. For example:

"Users on average phones can load and interact with this site in 5s on a 3G or better network".

If we look at the sequence of communication between a browser and a server, a few hundred milliseconds (400-600ms) will already be used up by network overhead and round-trips: DNS lookup to resolve the host-name (e.g google.com) to an IP, network round-trip to do the TCP handshake and then a full round-trip to send the HTTP request.

This leaves us with ~4+ seconds to transfer data while still keeping the page interactive. On a 3G network, you can probably at best get away with sending 130-170KB of resources while meeting your targets. If your users are on 4G/LTE, you may be able to send more. The variability of mobile networks means that, even if you're on a high-end phone over LTE (e.g iPhone X) your network speeds can effectively be slower than you'd like. This is why developing for a "poorer" baseline is great. It means even under worse conditions you're still able to deliver a good user experience.

On desktop, it's a different ball-game. Your users are likely connected to more reliable WiFi/cable on a CPU-beefy machine. You can probably get away with shipping MBs of code to your users there. That said, many of us have gone through the pain of trying to use WiFi from a coffee shop, at a conference or on a plane. When your effective network connection speed is poor, you can start to feel the pain of those MBs even on a desktop machine.

"Less is better" is always a good mantra to hold regardless of device and network type :)