4 ms·
What is the trade off between hosting icon/picture image files versus drawing them? Is there one? Is this method (drawing through js) better if client download
by josh33 16y ago
What is the trade off between hosting icon/picture image files versus drawing them? Is there one? Is this method (drawing through js) better if client download speeds are really slow?
- JeffJenkins 16y agoThe trade-off is between client-side CPU and bandwidth/connections. A vector graphic is going to be much smaller for icons and other non-photo images. The downside is that instead of just shoving some bits onto the page, the client has to run a script to tell it what the bits are supposed to be.
- ThomPete 16y agoVectors are great kb savers if they are fairly simple. In this case they are ultra simple. But if you want to do much more complex vector graphics you should probably consider using .png or .gif instead
- JeffJenkins 16y agoAnd where the trade-off is depends on the size of image you want to display.
- mseebach 16y agoJust for showing a static icon, it's very likely to be a bad trade-off not to just use an image file. It's a highly optimized path, both client- and server-side It's when you need small variations, e.g. in color, size or shape, or some animation, that benefits kick in. Also, you can put all icons in the same easily cacheable JS-file.
- megaman821 16y agoFor simple icons like this where there a lots of them, drawing them for the js definitions is going to be greatly faster. If they were separate files it would take 91 requests to get them all. Even if the icons where regular images I would use either data uris or an image sprite.