Choosing frame rate

Recently I have been trying to identify performance problem in my SWF and to that end enrolled in Monocle prerelease program. That is where I have found this post by Gavin Peacock, Adobe:

The problem is that the GPU memory can only be swapped once in a 60th of a second when VSync is enabled by the OS. If the player tries to swap GPU memory a second time, the call will block until the next VSync occurs. “Waiting for GPU” reports the amount of time blocked waiting for the next VSync. VSync is generally fixed at 60 FPS by the hardware.  But you can set the frame rate of your SWF to any value less than or equal to 60 FPS.  Setting a lower frame rate may actually improve your performance because you can avoid this blocking time. As it is there is kind of beat interference between the hardware VSync and the player frame rate. We have been working with the runtime team to find ways to reduce this effect.

My reading is that if your frame code is able to run fast enough to actually call context3D.present() faster than every 1/60th of second, you will be losing frames and your fps will go down dramatically. Therefore you should settle at something less than 60 fps.

Update: with Nov. 6 FP 11.5 release the situation around frame rate has changed, apparently. Here is another quote from Gavin Peacock:

Since there can be multiple instances of the flash player each running at different frame rates, the player will try to synchronize wake up times to even multiples of  60fps. If you set your frame rate at something that divides evenly into 60, you will get a nice even set of grey bars that line up pretty closely to the red line. But if you select, something that doesn’t divide evenly, like 24fps, you will see the grey bars dance up and down around the red line.

This is how it looks in profiler timeline:

The conclusion is that only 30, 20, 15, etc, fps will now run without random frames taking more time than they should for no reason. Also note that 60 fps swf now also runs fine for the most of time (but for some reason still skips frames if there is mouse activity).


1 Response to “Choosing frame rate”

  1. 1 ben w November 9, 2012 at 16:24

    Well that certainly helps explain a lot!

    This basically will screw anyone who is trying to make a 60 fps game when the client has any banners running somewhere (which there almost always is) as guidelines on most site recommend a frame rate of 24 or 18 fps for advertisements.

    Thanks for taking the time to write it out so clearly with pics as well.(the inconsistency of those grey bars was doing my nut in)

Ask a Question

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Old stuff

October 2012
« Jun   Dec »

Oh, btw…


%d bloggers like this: