I’m trying to make my web app. a bit quicker. Each page has about 20 to 200 images that are pulled of the web..they are favicons actually and the line of code below works well for me.
var google_favicon = 'http://www.google.com/s2/favicons?domain=' + domain;
I could of course download them and put them on my server. Because I don’t know which way is best practice I just pull them off the web.
However, I’d like to do it the best way, which to me means the fastest. Is there an answer or does it depend on such things as the quality of your hosting provider?
Thanks
It depends quite a bit on how fast/reliable the sites serving the content are vs. how fast your server is. Many high-traffic sites use a Content Delivery Network (CDN, e.g. Akamai) to serve their static content because CDNs have servers located in many areas and can typically get the content to the user more quickly.
My guess is that these favicons are hosted by many different providers, which means that the ‘uptime’ of your site (as defined by all of the content loading properly) is going to be the lowest common denominator of the uptime of all of the sites that host your images.
You also need to consider that since you don’t control the sites that host these images, they could move/remove them at any time and then they would be broken.
How often do you change the images on your site? If it’s not that often and you are concerned about uptime/performance, I’d probably try to serve them all from a host that you control, whether that’s your own machine or something else.