love.graphics.print causing large performance hit

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

love.graphics.print causing large performance hit

Post 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?
User avatar
bmelts
Party member
Posts: 380
Joined: Fri Jan 30, 2009 3:16 am
Location: Wiscönsin
Contact:

Re: love.graphics.print causing large performance hit

Post 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.
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: love.graphics.print causing large performance hit

Post 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. ;)
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: love.graphics.print causing large performance hit

Post 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)
When I write def I mean function.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 223 guests