What's best, a repeating background of 100px wide so that the actual file doesn't need to be redrawn 1000X times in width, or a 1px file that probably has smaller file size but the browser will need to redraw it a lot more?
+6
A:
A small file that the browser will have to repeat. It takes almost no computer processing to repeat a 1kb file but repeating a 10-15kb file will be more taxing I'd think. The smaller the better.
dscher
2010-05-07 14:09:35
+1
A:
The standard image width to use for this sort of thing is 1 px. The smaller the image, the less data there is to transfer over the network, which means less time waiting for the page to load.
If you're going to be repeating some chunk of data anyway, why not make it as small as possible?
Matt Ball
2010-05-07 14:12:23
Sorry for the late reply here but to answer your question: why *not* make it as small as possible. I thought maybe, if I make a repeating image 10px wide instead of 1px, maybe the drawing process in the browser would be faster because it would only have to repeat x / 10 times.
tdskate
2010-10-02 20:26:58
@tdskate: you're welcome to run your own performance tests. I think you'll find a negligible difference in paint speed between repeating a 1px image and a 10px image. Also, if you're _that_ concerned about the performance difference then you should be using a 10000px wide image so the browser doesn't ever have to repeat the image. Here's what you should really take away from the discussion: **if performance is an issue, use the tools available to you** (profilers and the like) **and then optimize the objectively identified bottlenecks.** You're only wasting your time with...
Matt Ball
2010-10-02 21:35:18
...micro-"optimizations" that aren't realistically going to net you any gains. One last thing: I would recommend taking @Andy's comment (below [your question](http://stackoverflow.com/questions/2789152) to heart, and accept some answers to your other questions. Your (currently) 0% accept rate makes me wonder - are you unsure of how to accept an answer, or are you just unwilling? You certainly don't need to accept an answer to every question you ask (I don't!). That said, accepting a particular answer serves two purposes: it's a nice gesture of thanks to those that take the time and energy...
Matt Ball
2010-10-02 21:42:34
...to help you out; in addition, it's an _especially_ useful indication to others who come to the site with the same problem that you had, so they can easily know which answer actually solved your (and could solve their) problem. Have a look over the [FAQ How-to-ask section](http://stackoverflow.com/faq#howtoask) and maybe you could pretty-please accept some answers :) Thanks!
Matt Ball
2010-10-02 21:46:10
Sorry. Had no idea about the accept rate. Anyway I thought I read somewhere it was better to use 10px width. I accept your answer because now I got confirmation now that it's negligible. Thank you sir!
tdskate
2010-10-03 09:50:36
@tdskate - glad to have cleared that up. Sorry for the comment rant.
Matt Ball
2010-10-03 13:37:50