Changing image lags CPU

rrowland

New Member
Hey all,
I'm on a computer with a fairly strong CPU (3.4GHz quad core) and I get a CPU Usage spike from 0% to 15% when changing the URL of an image on my website. This produces a visible lag on the page, and I can only imagine how this will look on slower computers.

I am using a large image, 1920x1080, as it serves as the background for the site. It is a photo background, the background serves as a gallery of sorts as you navigate through the pages via AJAX so it is necessary to use a large image.

Before a simple switch, I attempted to fade one image into another (using two divs with an opacity fade on the foreground div) and that was, of course, much laggier.

Is there any way to cut down on this lag? I would imagine this is a browser limitation caused by using the CPU instead of hardware acceleration, but wasn't GPU rendering promised? Flash files can create the same effects with the same sized images with virtually no lag.

It is absolutely imperative that I'm able to incorporate some workaround to this problem for my project. I can't use flash at all. If anybody can think of any way to work around this and achieve the desired affect, please let me know.
 

CaldwellYSR

Member
Your browser caches images. So when you have one image on the screen it will only be slow to load the first time. After that the browser saves that image and when you go back to the page you don't have to load it from the server your browser just spits it back out. When you change that image request the browser has to go back to the server, thus the cpu spike. With an image that large you're going to have a spike. The way I typically avoid this is to "optimize" all my images for the web. This makes them much smaller files and much snappier loads. Unfortunately it also cuts the quality some so you have to find a good balance where the quality is still good and your load time is also good.
 
Top