Page 1 of 1

Love hiccups on decent computer

Posted: Tue Dec 04, 2012 11:18 pm
by eiyukabe
I am working on a game with a friend and noticing some odd hiccups using the love engine on my machine (not just in our game, but in any game/example I run using Love). As an example, I get a hiccup where the program freezes for about a second when running the zoetrope demo's sprite benchmark (http://libzoetrope.org/). I can get over 2000 sprites in the sprite benchmark at 60fps, but there are those hiccups when getting there. My machine is fairly new (Intel Core i7-2600 @ 3.4GHz, 8 GB RAM) and I am running Windows 7 Home Premium 64 bit. I can run games like Skyrim fine and get these hiccups even after doing a reboot so I don't think it's performance related.

What's even more confusing is it doesn't seem to be related to garbage collection. In our game I use collectgarbage('count') every frame to show memory usage and the sharp declines (when I assume it is garbage collecting) do not line up with the hiccups. That is sometimes it hiccups and the memory keeps rising, and sometimes it hiccups and there is a drop in memory use right after the hiccup.

When I run love programs on my laptop, which is older and less powerful but also uses windows 7 64 bit, I do not see these hiccups.

Has anyone had similar issues, or does anyone have any insights?

Re: Love hiccups on decent computer

Posted: Wed Dec 05, 2012 12:28 am
by Lafolie
Source code! Always source code. It helps immensely, without it it's pretty hard for us to pin down the cause of the "hiccups". As a side note I'd recommended not using the collectgarbage("count") call too much, I recall reading somewhere that repeated calls can impact performance.

Also I might as well throw out the "update your drivers?" solution. It has helped in some cases.

Re: Love hiccups on decent computer

Posted: Wed Dec 05, 2012 12:33 am
by ejmr
I am eiyukabe's friend. I just wanted to add that I do not get any hiccups or freezes like he does when running the zoetrope sprite benchmark. I am running Ubuntu 12.10, Linux 3.5.0-19-generic, with four Intel Core i3 CPU M 350 @ 2.27GH processors and 4 GB RAM. I am also using LÖVE 0.8.0 compiled to use LuaJIT.

Re: Love hiccups on decent computer

Posted: Wed Dec 05, 2012 12:44 am
by eiyukabe
I'm not sure I can provide useful source code. The problem isn't just with our game, it happens with the zoetrope demo I linked (which I did not write), and it happened with another love-based game I downloaded. It seems to have something to do with things written in love on my PC (but not my laptop). I can try to write some small programs and see which ones cause it to happen and then post that if that would be useful.

Thanks for the heads up on collectgarbage("count"), I'll remove it -- just wanted to see if the hiccups happened alongside garbage collection.

Re: Love hiccups on decent computer

Posted: Wed Dec 05, 2012 1:18 am
by Lafolie
Boolsheet informs me that I was mistaken.
<Boolsheet>Lafolie: You were probably thinking of collectgarbage("collect") when you recommended not to use "count" often. Getting the count is very fast as it just retrieves a integer.
Have you tried grabbing some stuff from Projects and Demos and seeing if they run alright? There might be a theme to problem if they do.

Re: Love hiccups on decent computer

Posted: Wed Dec 05, 2012 1:20 am
by Boolsheet
I'd blame the graphics driver and its OpenGL implementation. I don't think this is coming from LÖVE or Lua, they're usually fast enough that it has to wait for the vertical synchronization on every frame. If it is the vsync part of the graphics driver, you could check if love.graphics.present blocks unusually long. Save every dt value passed to love.update to a file and check if they're all around 16 ms. If there's a spike every 60 frame, we know there's something fishy going on. :P