Page 1 of 1

Weird image load times

Posted: Sat Jun 06, 2015 3:50 pm
by SFAriel
Hey,

I have been experiencing this weird problem where creating a new image from an imageData object appears to have varying load times. Now that in itself is normal, but when every second image takes noticably longer to load then I become very suspicious. Take a look at the following image taken from the console (first column: imageData width*height, second column: raw data decode time (I decode a binary file into imageData using setPixel), third column: love.graphics.newImage time, all times are in milliseconds):
Image

The only relevant information here is the last column, really. As you can see, some images take ~13 ms while others take waaay less. I can post more information if necessary.

Re: Weird image load times

Posted: Sun Jun 07, 2015 5:10 am
by Positive07
Having a look at the data would be nice, if a tile is mostly transparent (255, 255, 255, 0, I think) then that would probably take less time to generate (not sure really), also have you noticed that this may be size relevant? The taller images take more time to load (135 vs 99) Still I dont think this should be a HUGE difference as you have shown. Posting the .love that give you this results would be nice (Since now you got me really interested here hahaha)

Re: Weird image load times

Posted: Sun Jun 07, 2015 9:06 am
by s-ol
Might be related to https://love2d.org/wiki/PO2_Syndrome ; according to that page some images have to be reformatted by LÖVE during loading.

Re: Weird image load times

Posted: Sun Jun 07, 2015 10:40 am
by Nixola
S0lll0s wrote:Might be related to https://love2d.org/wiki/PO2_Syndrome ; according to that page some images have to be reformatted by LÖVE during loading.
I don't think that's the issue, since none of the images are PO2-sized.

Re: Weird image load times

Posted: Sun Jun 07, 2015 12:12 pm
by T-Bone
A wild guess: Since the slower images as consistently larger (even if only slightly larger) it could be that there's some cache level somewhere, where the smaller images fit and the bigger ones don't, resulting in a disproportionate difference in computation time.

Re: Weird image load times

Posted: Sun Jun 07, 2015 12:47 pm
by SFAriel
Files are right here. It has the love file in it and some additional (zlib) libraries necessary to inflate some data while loading the sprite. WASD moves the camera, mouse wheel zooms in and out, arrow key left/right changes sprite facing direction, arrow key up/down changes current sequence. The images are loaded on-demand as the sprite requires it, and their decode and creation time will be displayed in the console. The function which loads the images is in exporter.lua at around line 21 (exporter.decodeImage).

If anyone could come back with further information, I would really appreciate it. Give the game a little time to load, sadly parsing that sprite file takes a good 3 seconds or so on my setup.

As for the image width and height difference, I tried enforcing a minimum size to bring them in line at some point, but same results really.

Re: Weird image load times

Posted: Sun Jun 07, 2015 2:27 pm
by Nixola
I just tried it and, despite having higher numbers in the first column, the second one looks perfectly normal. Windows 7 x64.

Re: Weird image load times

Posted: Sun Jun 07, 2015 4:24 pm
by SFAriel
Thanks, might be a driver or hardware issue on my end then.