Skip to main content
zeh
Inspiring
July 10, 2013
Question

Using GameInput adds big Timer event overhead to AIR app execution

  • July 10, 2013
  • 1 reply
  • 8786 views

When using GameInput by merely referencing GameInput.numDevices, an overhead of about 38ms for internal Timer event execution is added to Flash player once every second.

I have a "sandbox" AIR 3.8 Flash project that does nothing other than trace some properties to the console. Execution of this sandbox in Adobe Scout (with a non-debug SWF, using advanced-telemetry, and with all unnecesary options disabled to avoid overhead) looks like this:

It's all well and good. However, the mere addition of trace(GameInput.numDevices) once changes the execution radically. The result is this:

Every second, there's a ~38ms event overhead. Apparently, after the first reference to numDevices, the player starts checking for device addition/removal once per second, but it takes some time to do so (again, no other code is being executed).

To be fair, I'm not sure exactly of the impact of that in actual execution. Apparently, it's only adding 6ms to the time it takes to go from ENTER_FRAME to EXIT_FRAME. But even if that's the case, with a budget of ~17ms per frame, that's considerable overhead.

This was tested on a PC with Windows 7. Player/Air version was WIN 11,8,800,88. No devices were actually attached to the computer.

I haven't tested with Android/OUYA. I know GameInput works, but I haven't been able to test if the overhead is there.

I can provide more details, but it should be easy to reproduce on its own. All you need is a reference to GameInput.numDevices.

My question is: is this expected or is it part of something that's still being worked? The addition of the GameInput API to the desktop version of AIR is most welcomed, but a potential 223% execution budget overhead on a frame once every second is potentially disastrous for games since it'd mean constantly skipping frames.

This topic has been closed for replies.

1 reply

Participating Frequently
July 11, 2013

Thanks for your report. And this issue has been confirmed with the developer and an overhead is expected on windows. More info is here:

"  The Windows version of the GameInput API checks every 1 second if devices are attached (calling numDevices or instantiating the GameInput class does start this check).  This should not be an issue on Mac or Android since they listen for an event (Mac Chrome might see this issue)." --from dev.

Participating Frequently
July 11, 2013

I encoutered this exact same thing late last night. I'm also curious if there are plans for this to be fixed (I guess it's not exactly broke... improved?) with the full release of AIR 3.8? In the meantime is there a workaround? I would think that it isn't absolutely necessary to check for new connections every second most of the time. Is there some way to turn off this timer once a connection to the device has been created?

Like zeh said this doesn't really affect development, but it does make the app a little jarring to play. I'm experiencing a ~66ms frame once per second, so all of my sprite movements appear to jump around.

zeh
zehAuthor
Inspiring
January 9, 2014

Hi Guys,

Sorry that this is occuring.  I am going to let the team know about this thread to make sure we are aware of the issue.  Does anyone have a bug number that I can reference?

Thanks,

Chris


Hi Chris, thanks so much.

There's one bug report about the same problem:

https://bugbase.adobe.com/index.cfm?event=bug&id=3660823

I'd say this thread has more information on the problem, though.