Weird image load times

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
SFAriel
Prole
Posts: 3
Joined: Sat Jun 06, 2015 3:40 pm

Weird image load times

Post 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.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: Weird image load times

Post 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)
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Weird image load times

Post 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.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Weird image load times

Post 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.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: Weird image load times

Post 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.
SFAriel
Prole
Posts: 3
Joined: Sat Jun 06, 2015 3:40 pm

Re: Weird image load times

Post 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.
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Weird image load times

Post by Nixola »

I just tried it and, despite having higher numbers in the first column, the second one looks perfectly normal. Windows 7 x64.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
SFAriel
Prole
Posts: 3
Joined: Sat Jun 06, 2015 3:40 pm

Re: Weird image load times

Post by SFAriel »

Thanks, might be a driver or hardware issue on my end then.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 6 guests