Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are image sprites actually more efficient than separate images?

I started using image sprites around 2 years ago because I saw sites such as Apple and Facebook using them on their sites.

It goes without question that loading a page is faster if you download one 60kb image, instead of three 20kb images, however, I have recently been informed that sprites, albeit faster at loading, are in fact a lot more memory consuming on the client side.

In my eyes:

  1. Sprites are faster at loading and use less bandwidth
  2. From a developers point of view, they are easier to maintain because all of your graphics are in one place

However, in my colleagues eyes:

  1. Each time the sprite is referenced on the page, the image is created in memory, which in turn slows down the clients browser
  2. The difference in speed of loading is not sufficient enough to justify the increased memory usage of the browser
  3. The internet is designed to transmit in small packets, therefore loading smaller images is better then loading larger ones

This leads me to ask the question, are sprites are actually worth using or is my colleague barking up the wrong tree?

like image 668
Ben Carey Avatar asked Aug 21 '12 08:08

Ben Carey


People also ask

What is the benefit of using image sprites?

The main advantage of using image sprite is to reduce the number of http requests that makes our site's load time faster. The images also load faster making switching from one image to another on some event much smoother. Image Sprite are a collection of images placed into a single image.

Should I use image sprites?

A web page with many images can take a long time to load and generates multiple server requests. Using image sprites will reduce the number of server requests and save bandwidth.

What is the importance of CSS Sprites?

The concept of CSS sprites is used to reduce the loading time for a web page because it combines the various small images into one image. It reduces the number of http requests and hence the loading time.

What is the visual image of the Sprite?

Ans. The visual image of Sprite is called its costume. 4.


1 Answers

Using an image more than once in a page doesn't mean that there is one copy of the image for each place where it is used.

If it did, a page like this demo fiddle would use around 7 GB of memory. It doesn't.


Loading one image is always faster than loading several images. Reducing the number of requests is important when optimising the performance of a site. The fact that the internet is designed to transmit small packages only makes the impact of loading several small images less than it could have been.

like image 89
Guffa Avatar answered Oct 14 '22 05:10

Guffa