Page 1 of 1

Strange Performance Issues

Posted: Sun Jul 03, 2011 10:45 pm
by Simtex
I've got some strange performance issues that I wanted to see if others were getting. Now this is running on a laptop video card, but one of the newer ones (Intel 4500MHD). On this computer I can play this...

http://riot-web-static.s3.amazonaws.com ... ens/19.JPG
(game called League of Legends)

...at around 25-30 fps. So it's not completely powerless.

Anyway, the following LOVE program runs at ~720 FPS on my computer:

Code: Select all

function love.draw()

	love.graphics.print("FPS: " .. love.timer.getFPS(), 50, 20)
	
end
So far so good, but if I add three more lines of text, like this:

Code: Select all


function love.draw()

	love.graphics.print("FPS: " .. love.timer.getFPS(), 50, 20)

	love.graphics.print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 50, 80)
	love.graphics.print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 50, 100)
	love.graphics.print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 50, 120)

end
The FPS drops to 200, a difference of about 520 FPS. This is with LOVE 0.7.2

Combined with some textures, this is making games with rather simple textures (all of which follow the Power-of-2 rule properly) plus some text, slow down to ridiculous levels. I've made sure the usual suspects are eliminated (trying to create fonts every update, etc.) so I'm starting to run out of optimizations. It really seems like this stuff shouldn't be such a problem.

Can anyone run the two above LOVE programs and see what kind of results they get?

Re: Strange Performance Issues

Posted: Sun Jul 03, 2011 10:47 pm
by Jasoco
Fonts are getting an overhaul in 0.8 I believe. I assume it includes image fonts.

Re: Strange Performance Issues

Posted: Sun Jul 03, 2011 11:45 pm
by tentus
There's an article that I can't seem to find again about how game framerate costs are not constant. We think in terms of 1 object costing us 1 frame, but that's not really the case: the first object you add is going to have a tremendous cost, as will the second, but the more objects you add the less they seem to hurt your framerate. Its because the first object represents, say, a 200% increase in things to think about, the second being a 50% increase, and so on.

Attached is a shoddy little .love that can be used to illustrate what I'm talking about. Press up to increase the number of text layers, and down to decrease them.

My point is that don't be too surprised by a massive frame drop when you're fps is at 700. It will take you a while to chisel that down to below 60.

Re: Strange Performance Issues

Posted: Mon Jul 04, 2011 4:40 am
by Simtex
tentus wrote: My point is that don't be too surprised by a massive frame drop when you're fps is at 700. It will take you a while to chisel that down to below 60.
I understand what you are saying, and you are certainly correct that the first couple objects are the biggest hits to performance, and adding more is a non-linear performance hit. I do see that kind of behavior, and would be okay with it if it leveled off at a reasonable place, but something else seems to be up here.

I went ahead and printed out the LOVE readme.txt using the following code, my fps dropped to 20-22.

Code: Select all

test1 = [[
LÖVE is an *awesome* framework you can use to make 2D games in Lua. It's free, open-source, and works on Windows, Mac OS X and Linux.

RUNNING GAMES
-------------

In Windows or other graphical enviroments, just open the .love file you want to 
run with the love binary, such as love.exe. (~^-^)~

In a console, type "love" followed by the relative or absolute path to a directory 
(or archive).

Examples: 

* love mygame.love
* love /home/hax/ultragame

Remember that what you are trying to run at least should contain the file "main.lua". 

Compilation
-----------

Windows:
	Use the project files for Visual C++ 2008 or 2010 (2010 preferred) located in the platform dir.
*nix:
	Run platform/unix/automagic, then run ./configure and make.
OSX:
	Use the XCode project in platform/macosx.


! WARNING ! 
-----------

This software is not complete. This is just a preview. Don't expect to find any 
interface consistencies between releases at all. With each release, everything 
you once knew and loved may be brutally murdered. By which I mean removed and/or 
changed.
]]

function love.draw()

	love.graphics.print("FPS: " .. love.timer.getFPS(), 50, 20)

	love.graphics.print(test1, 0, 40)

end

Re: Strange Performance Issues

Posted: Mon Jul 04, 2011 6:13 am
by bmelts
Well, the fact that text rendering is awful and slow in 0.7.2 doesn't really help matters there.