0.8.0 vs 0.9.0 benchmark = yay!

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
BozoDel
Party member
Posts: 164
Joined: Fri Nov 01, 2013 10:28 pm

0.8.0 vs 0.9.0 benchmark = yay!

Post by BozoDel »

So I took the latest official version of zoetrope (0.8.0) and another version with 0.9.0 patches, and used its sprite and collision benchmarks. The sprite ones could go on forever, so I set a time limit of one minute. At the end of that time, I would write down the number of sprites it could put on screen maintaining 60 fps.

0.8.0:
sprites: 891
simple collision: 534
displacing collision: 498

0.9.0:
sprites: 2217
simple collision: 1020
diplacing collision: 1025
diplacing collision: 1010

Yeah, I ran the last test twice.

THAT'S REAL AWESOME, THANKS DEV TEAM!
jjmafiae
Party member
Posts: 1331
Joined: Tue Jul 24, 2012 8:22 am

Re: 0.8.0 vs 0.9.0 benchmark = yay!

Post by jjmafiae »

This is a huge difference, that's amazing!
User avatar
slime
Solid Snayke
Posts: 3133
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: 0.8.0 vs 0.9.0 benchmark = yay!

Post by slime »

Do the benchmarks use SpriteBatches? If not, they aren't really testing the right things (SpriteBatches are what you should use when you care about performance when drawing sprites.)
Also, I suspect you're testing the difference between calling C API functions in Lua versus LuaJIT more than anything else.
User avatar
Jeeper
Party member
Posts: 611
Joined: Tue Mar 12, 2013 7:11 pm
Contact:

Re: 0.8.0 vs 0.9.0 benchmark = yay!

Post by Jeeper »

slime wrote:Do the benchmarks use SpriteBatches? If not, they aren't really testing the right things (SpriteBatches are what you should use when you care about performance when drawing sprites.)
Also, I suspect you're testing the difference between calling C API functions in Lua versus LuaJIT more than anything else.
SpriteBatches should (or can?) only be used on static things right? Since they save a location, if that changes it wont work right?

So background stuff and other environmental things should be drawn with spriteBatches but moving things such as the player should be drawn normally. Or have I misunderstood?
User avatar
slime
Solid Snayke
Posts: 3133
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: 0.8.0 vs 0.9.0 benchmark = yay!

Post by slime »

Jeeper wrote:SpriteBatches should (or can?) only be used on static things right? Since they save a location, if that changes it wont work right?

So background stuff and other environmental things should be drawn with spriteBatches but moving things such as the player should be drawn normally. Or have I misunderstood?
SpriteBatches can be used anywhere that you can draw more than one of the same image (or more than one quad using the same image). They also should be used in that situation, if performance is a concern.
They'll almost always be faster than drawing images by themselves (even when clearing/re-adding to the SpriteBatch every frame) as long as you put more than one thing in the SpriteBatch, and use SpriteBatch:bind / SpriteBatch:unbind when adding or setting more than a dozen or so.

0.8.0's code has some inefficiencies in the SpriteBatch implementation compared to 0.9.0, but some of the above is still true for 0.8.0.

Any group of things which either have the same image or can be converted to use a texture atlas can use a single spritebatch which only needs to be modified when the properties (position, color) of the sprites change relative to other sprites in the same batch.
Last edited by slime on Fri Dec 27, 2013 8:03 pm, edited 1 time in total.
User avatar
MadByte
Party member
Posts: 533
Joined: Fri May 03, 2013 6:42 pm
Location: Braunschweig, Germany

Re: 0.8.0 vs 0.9.0 benchmark = yay!

Post by MadByte »

I wonder which is the right way to use a spritebatch for dynamically updating / moving sprites.
I Tried the follwing but it does not work as expected. :D ( see my next post for the files! )

Any help with that?

Examples moved to a later post !
Last edited by MadByte on Wed Jun 25, 2014 12:05 pm, edited 2 times in total.
User avatar
BozoDel
Party member
Posts: 164
Joined: Fri Nov 01, 2013 10:28 pm

Re: 0.8.0 vs 0.9.0 benchmark = yay!

Post by BozoDel »

slime wrote:Do the benchmarks use SpriteBatches? If not, they aren't really testing the right things (SpriteBatches are what you should use when you care about performance when drawing sprites.)
Also, I suspect you're testing the difference between calling C API functions in Lua versus LuaJIT more than anything else.
It seems like zoetrope doesn't use SpriteBatches. DOES THAT MEAN THAT PERFORMANCE IS EVEN MORE ÜBER AMAZING?!?!?!
User avatar
MadByte
Party member
Posts: 533
Joined: Fri May 03, 2013 6:42 pm
Location: Braunschweig, Germany

Re: 0.8.0 vs 0.9.0 benchmark = yay!

Post by MadByte »

I just tried some things out using spritebatches for updating stuff.
When I'm not using spritebatch:bind / unbind inside the update loop the performance is almost the same as when I'm updating stuff the regular way without batches, but still it is not as fast with batches as the same without batches. Sorry for being pesistent but I'm really interested in some anwsers for that kind of stuff. I'm obviously not that experienced with it, but if there is a chance to increase performance using spritebatches I want to know that.

Here is the example using a spritebatch ( without bind / unbind inside love.update ):
withSpriteBatch.love
And here is the example without a spritebatch :
withoutSpriteBatch.love
edit: sorry uploaded the "withbatch" version without the "bind / unbind" fix... I changed that now.
User avatar
BozoDel
Party member
Posts: 164
Joined: Fri Nov 01, 2013 10:28 pm

Re: 0.8.0 vs 0.9.0 benchmark = yay!

Post by BozoDel »

I remember that in the ATL examples you could alternate between with/without SpriteBatches. There was always a good difference in performance, but it varied. It was a great difference when the tiles didn't overlap, but not that much when in isometric. Maybe you can check that out, MadByte? (and share your findings, cause I got a bit curious too)
User avatar
MadByte
Party member
Posts: 533
Joined: Fri May 03, 2013 6:42 pm
Location: Braunschweig, Germany

Re: 0.8.0 vs 0.9.0 benchmark = yay!

Post by MadByte »

Cool, I didn't thought about that and you're right. When the entities does not overlap the spritebatch version is ~100FPS better for me then the version without spritebatch.

With:
NoOverlappingWithBatch.love
Without:
NoOverlappingWithoutBatch.love
But if this is the only advantage using a spritebatch I don't see how this can help in a game exept a tile based one.
Still I'm not completly sure if there isn't another (better) way to create the batch which give us a better performance.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 220 guests