Page 1 of 1

love.graphics.print causing large performance hit

Posted: Mon Feb 14, 2011 5:30 am
by slime
I have five love.graphics.print calls in my code currently, and the one with the most text is "Health: 2000/2000" (they're all at default font/size too), so it's not like I'm printing whole paragraphs, however when I comment these calls out my FPS jumps drastically, from 390fps to 560fps. Is this normal? Is it a problem with the code, or something on my end, or is it unfixable?

Re: love.graphics.print causing large performance hit

Posted: Mon Feb 14, 2011 5:34 am
by bmelts
love.graphics.print is not very fast. This is because fonts are not very fast. 0.8.0 should bring a new font engine with much improved speed and memory consumption, among other things.

On the other hand, it doesn't sound like it's posing much of a problem for your game at the moment, unless you really need people to play it at 500fps. So I wouldn't worry about it for now.

Re: love.graphics.print causing large performance hit

Posted: Mon Feb 14, 2011 5:40 am
by slime
Well, yeah, but in a more "live" situation with my background and NPCs enabled it goes from 250fps to 320fps, plus I was planning on having more things printed onscreen than I currently am.

Oh well, good thing it's being redone soon™ at least. ;)

Re: love.graphics.print causing large performance hit

Posted: Mon Feb 14, 2011 6:56 am
by kikito
Also, make sure that you are not creating a new font on every frame (for example, invoking love.graphics.setFont(number) inside love.draw)