Charts · 21
What a byte of JavaScript costs
The same number of bytes as a JPEG and as a bundle arrive over the same wire in the same time, and only one of them then stops the page. An image is decoded off the main thread and painted. JavaScript has to be parsed, compiled and run, on the thread that also handles your tap, before anything it renders can appear. Pick a size, press measure, and the page builds that bundle and times every stage on your own machine.
download (Fast Wi-Fi: 20 ms round trip then 100 Mbps, on an assumed 3.5× gzip) · parse and compile · first execution. Press measure for real numbers. The JPEG lane is the same bytes on the wire, so the download is identical: the whole difference is the main-thread work, because an image is decoded off-thread and never executed.