Live data from Hacker News

CSS Sprites vs. Data URIs: Which is faster on mobile?

mobify.com

21–25 of 25 posts

Re: CSS Sprites vs. Data URIs: Which is faster on mobile?

#21
I'd be curious as to the underlying why here.

I imagine that CSS parsers aren't particularly designed with any kind of parallel operation, whereas grabbing images (& decoding them) is largely done in parallel (up to the number of max connections). So while you're parsing the CSS you can be getting the images, offsetting the connection cost.

In the CSS case, the device needs to get the (slightly larger) CSS, un-gzip it (with more complex tables), Base64 decode - and then decode the image as before. I wouldn't be surprised if this is a completely sequential activity with the rest of the CSS parsing.

Re: CSS Sprites vs. Data URIs: Which is faster on mobile?

#24

Inlining all of your images as data URIs in your CSS is not a good idea because it will block the rest of the stylesheet from loading whilst images will not.

and thusly will block the document from loading, most likely delaying first paint.

Re: CSS Sprites vs. Data URIs: Which is faster on mobile?

#25
I must have missed the Data URI hype, because I'm not at all shocked that CSS spriting is faster than using Data URI. We are comparing using a binary image format, and a base64 encoded image inlined into CSS/HTML.

What isthe basis or the source of the idea that base64 encoded images inlined into the CSS would be faster?

Post reply on HN