I have some slow loading times and I'm not sure what to do!

Hi! I’m getting these messages at various points in my game, and I’m not sure why or what I could have done. I’ve checked the messages that are sending and I can’t quite understand what would cause these delays. Can anyone give me a pointer on what I could investigate?

WARNING:DLIB: Profiler Resource.Get took 2.199 seconds
WARNING:DLIB: Profiler GameObject.OnMessageFunction took 2.199 seconds
WARNING:DLIB: Profiler Message.Dispatch loader took 2.199 seconds
WARNING:DLIB: Profiler GameObject.DispatchMessages took 2.201 seconds
WARNING:DLIB: Profiler GameObject.Init took 2.203 seconds
WARNING:DLIB: Profiler Engine.Init took 2.380 seconds

Since you mention loading times, how are you loading the collections?

Okay, here’s the information I can give you:

I do for k,v in pairs(table) a lot. But the stuff I do to K, V, is pretty basic (maybe 35 very simple equations and 35 collectionfactory.creates). I don’t really have any huge sprites. I have one sprite which is 1000 * 350. I animate some sprites and have a very simple particlefx.

The bootstrap collection has a very basic GUI with a few nodes (no images) and two copies of that very big sprite.

Are you noticing a 2 second pause in your game? It seems like it should be obvious when it happens, so you can narrow down the problem.

You can use socket.gettime() to test how long things take. You can check if your collection loading is taking a while.

If you’re not loading tons of stuff or doing any huge calculations, maybe something outside of your game might be freezing it? For example you will get similar messages if you take a while dragging to resize the window.

1 Like

Thanks for your help ross. yes, I am noticing a two second pause. I think I might investigate what my scripts are doing and maybe start using local instead of self. ideas

The profiler will help you figure out the slowdown as well. You can make it track the peak frame and show the specifics of that frame.

1 Like

I will have to check that out. I have removed a lot of redundant code and sprites from the atlas which I no longer use, but i’m still not seeing a huge increase in speed. If it isn’t bad coding and it isn’t sprites… Any other ideas?

Have you tried the profiler?

Are you loading synchronously?