4 ms·
One thing that hasn't been addressed is the cost of making the second image request. There is probably a break even point for this technique where it becomes us
by nathanhammond 16y ago
One thing that hasn't been addressed is the cost of making the second image request. There is probably a break even point for this technique where it becomes useful, but the added complexity greatly limits its utility.
- pyre 16y ago> In one case we got a 573KB 24-bit PNG down to a > 49KB JPEG with a 4KB PNG alpha-mask! I somehow don't think that the cost of using two requests vs just one really matters with that kind of size difference (unless you're serving high-latency customers on satellite internet or something).
- nathanhammond 16y agoThat would certainly be beyond the break even point. :) In that case it's definitely another tool to keep in the back pocket in case needed. (Somehow I missed that line in the article by focusing in on the code.)
- mthoms 16y agoCould also use a data uri for the mask if a second request is really an issue.
- masklinn 16y ago> I somehow don't think that the cost of using two requests vs just one really matters with that kind of size difference On DSL it probably doesn't (let's consider a 150ms ping, we'll take that as the time to initiate an HTTP connection, with 10Mbps of bandwidth or 1.25MB/s): the single image will take 150ms + 440ms (download) for a total of 590ms, whereas the pair will take 2x150ms + 40ms + 3ms for a total of 343ms. Now consider 3G: 3.6Mbps (460KB/s) (we'll consider a pretty basic HSDPA) and pings of around 600ms are common. The single image takes 600ms + 1246ms for a total of 1846ms, whereas the pair takes 2x600ms + 100ms + 9ms for a total of 1309ms. Still lower, but we're getting closer. 7.2Mbps HSDPA bumps the bandwidth to 920KB/s and doesn't change the ping significantly. Now the single image only takes 632ms to download for a total of 1232ms, and the pair takes 54ms for a total of 1254ms. And cell data usage will only grow further. Now of course, a 573KB full-color PNG is going to be hell on a mobile browser and its cache, but still, HTTP request cost is coming back with a vengeance as HSPA makes high amounts of bandwidth available.