Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / How to test performance changes...

Author
Message
Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 13th May 2013 16:10
I'm trying to optimise our app, as some lower end devices seem to struggle with it. The problem I have is that I only have access to a Samsung S4. This phone runs the app without any problems (constant ~60 FPS) so its difficult for me to see if the changes I am making are actually doing anything... Is there anything I can check other than the FPS to see if the changes I am making are improving the performance?

Thank you!!
Impetus73
13
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 13th May 2013 16:38
The biggest problem is fill rates. If you have allot of overlapping sprites (Even transparent areas counts as filling), then some graphics chips like the Tegra 2, has limitations. It can barely run at 40FPS with 2x filled native resolution on the Galaxy Tab 10.1

Instead of a full screen HUD with a large transparent area in the middle, chop it up in 2 or more smaller sprites, that only occupy the actual graphics in the HUD. This will often give you 20FPS more from that optimization alone.

Remember that for every frame, everything on the screen has to be drawn from scratch, meaning 60 times a second for 60 FPS. I miss the good old days when you only updated parts of the screen.. but this is a limitation of the open GL system, I think.

----------------
AGK programmer
Did Amiga / AMOS programming in the 90's.
Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 13th May 2013 18:40
Thanks Impetus73, very useful info... So am I right in saying that the fill rate is only affected by what is being seen (rendered?). Anything off screen will not affect the fill rate?

I think the only way for me to effectively see any changes is to get hold of a 'low end' device so I can have a play and see what makes a noticeable difference.

I have lots of collision detection, raycasts etc etc so maybe there is something I can do there too...
Marl
13
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 13th May 2013 19:41 Edited at: 13th May 2013 19:46
Quote: " Is there anything I can check other than the FPS to see if the changes I am making are improving the performance?"


Yes, you can use a padding loop to eat up the spare cycles.

Basically a loop which does some unneeded but time consuming maths stuff.

The number of loops is increased until the frame rate drops below a certain value, then it is increased until the frame rate restores - a bit like how they measure blood pressure.

Any performance changes done to the rest of your code will be shown by the change in the number of padding loops - which indicates spare cpu time.

I posted some code somewhere for this.

Edit: From http://forum.thegamecreators.com/?m=forum_view&t=204311&b=41&msg=2442810#m2442810

This is slightly different - it aims to get the frame rate to fluctuate - i.e. get the loop to exceed the available frame time.

As such it doesn't restore frame rate once it's dropped.
Impetus73
13
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 16th May 2013 13:36
Yes, only the visible parts are rendered, the rest is clipped off.

Getting a cheap low end device is the only way to really test your game for speed on those devices.

----------------
AGK programmer
Did Amiga / AMOS programming in the 90's.
Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 16th May 2013 13:50 Edited at: 16th May 2013 13:51
Thanks Impetus73...

EDIT: Sorry Marl, thanks for your suggestion too
haliop
User Banned
Posted: 16th May 2013 13:51
btw funnel are you using in anychance GetImage?

haliop
User Banned
Posted: 16th May 2013 13:52
Marl...



why is the padloops inside a for loop?
shouldnt it calculate once instead of 1000 ?
i dont get it..

Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 16th May 2013 13:52
Hello haliop, no, I do not use GetImage...
haliop
User Banned
Posted: 16th May 2013 13:53
aha i see ok .. cause i found an awesome way to optimize it so it would run flawleslly every frame no matter the resolution you are working on DDDDDDDDDDDDDDDDDD !!!!!

Marl
13
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 16th May 2013 19:36
Quote: "why is the padloops inside a for loop?
shouldnt it calculate once instead of 1000 ?
i dont get it.."

It's not meant to be efficient, the exact opposite - it is meant to use up cpu time.

It is a way to measure performance - which was the point of the thread.

For example, if you have this in your code and it reads 20,000 pad loops, then you have 20,000 loops of additional code running which is not your program. Then you tweak your routines and try again.

If the loops reads higher, it is because there is more spare time in the loop to use up and therefore your main routine is taking less time - It shows spare time in the loop.
haliop
User Banned
Posted: 16th May 2013 19:38
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 18th May 2013 04:18
You can also try skipping calls to certain functions that don't necessarily need to be called every loop. For example, say you are calling setspriteshape on every loop for a bunch of sprites that have different shapes in each animation frame. It can be pretty heavy on the processor and the frequency of the calls can be reduced to match the fps of your sprite's animation.

Login to post a reply

Server time is: 2024-11-24 14:37:06
Your offset time is: 2024-11-24 14:37:06