loading images (not using them) slows the application... Why????

Hi all OF lovers.

i am just making an app where for each object i load some images, small ones…
i do NOT use the images, only load them.

in the update loop, i compute some coordinate-related function.
i found that without loading the images, this function takes 1 ms.
i they are loaded, it takes 100ms, aprox.
but i do not use the images for anything (i was using them to draw, but skipped that for debugging).
the coordinate-function does nothing to do with the images, neither with any draw…

so i am confused… why could that be???

any ideas??




Without seeing how you load the images, I can only guess that you are loading them from the hard disk which is so slow compared to RAM. You can resolve the issue by loading the images in the beginning (setup) and call them from the memory.

Can you share the part of the code where you load the images?

if you are loading the images within the update the slowdown is obvious; the images are being read from the hard drive and allocated in the RAM.
In general that’s a not good idea as you’re wasting lots of resources needlessly.
Just load the images during setup. That should not slowdown your app but it will use RAM space.
If you’re worried about the ram usage you should implement some way to load images during runtime.

and yes, if you post some code you could get a better answer.