pastelsky / bundlephobia

🏋️ Find out the cost of adding a new frontend dependency to your project
https://bundlephobia.com
MIT License
8.94k stars 221 forks source link

Download speed estimations are likely too optimistic #535

Open Calinou opened 3 years ago

Calinou commented 3 years ago

Please describe the feature/suggestion

I saw that the download speed estimations were revised since I last visited Bundlephobia. However, I feel that the new estimations are too optimistic and may skew developers toward adopting large libraries with less forethought.

I'll take an example with react@17.0.2:

image

According to the tooltips, the download speed for "slow 3G" is 400 kilobytes/s and the download speed for "emerging 4G" is 7 megabytes/s. However, these download speeds seem to be overestimated compared to what you usually get in practice. Even with fixed connections such as ADSL2+, you can't quite reach a download speed of 7 megabytes/s (except with top-tier VDSL2, but this is not accessible to most people). Yet, ADSL2+ remains quite common in many parts of the world.

Back when 4G was not readily available in my area (this was in 2015-2016 in France), it was rare for me to get download speeds above 50 KB/s in 3G.

I think kilobytes and kilobits may have been mixed up together here :slightly_smiling_face:

Describe the solution you'd like

Change the download speed for "slow 3G" to 400 kilobits/s (= 50 kilobytes/s) and the download speed for "emerging 4G" to 7 megabits/s (= 875 kilobytes/s). This reflects real world speeds more accurately, especially on smaller files since downloading the first bytes will often be slower than the rest of the file. In ideal conditions, it's possible to get much faster download speeds in 4G. However, people may be trying to load pages with really poor reception quality or on low-end devices with slow CPUs.

Also, we may want to take some kind of latency into account for the estimated download speeds. Maybe there could be a small "+ request overhead" label with a tooltip of the sort:

This estimated download speed does not take HTTP request latency into account. Downloading this code as a standalone file will incur latency from the HTTP request itself, which is generally between 50 ms and 300 ms depending on distance from the server.

Having accurate estimations is important, as people will use Bundlephobia for decision making. It's important to show that many people still have slow connections today. Developers should not assume that everyone has good 4G or fiber available.

Describe any alternatives you've considered

N/A

pastelsky commented 3 years ago

I agree that the initial speeds I added may have been too optimistic (it was the KB / Kb issue as you mentioned). This has been fixed.

As for latency — I don't think bundlephobia is the right tool to indicate that since most people would have several hundred modules in their bundles, but only have them bundled into 3-4 files on average. The latency cost is paid per file, and if loading in parallel / pre-connecting, even that cost might not need to be paid.

However, I've added a small note about us not including latency in the tooltip.

Thanks!