iPhone: Which are the most useful techniques for faster Bluetooth?

Posted by Mike Howard on Stack Overflow See other posts from Stack Overflow or by Mike Howard
Published on 2010-06-14T14:45:22Z Indexed on 2010/06/16 23:32 UTC
Read the original article Hit count: 182

Hi. I'm adding peer-to-peer bluetooth using GameKit to an iPhone shoot-em-up, so speed is vital. I'm sending about 40 messages a second each way, most of them with the faster GKSendDataUnreliable, all serializing with NSCoding. In testing between a 3G and 3GS, this is slowing the 3G down a lot more than I'd like. I'm wondering where I should concentrate my efforts to speed it up.

How much slower is GKSendDataReliable? For the few packets that have to get there, would it be faster to send a GKSendDataUnreliable and have the peer send an acknowledgement so I can send again if I don't get the Ack within, say, 100ms?

How much faster would it be to create the NSData instance using a regular C array rather than archiving with the NSCoding protocol? Is this serialization process (for about a dozen floats) just as slow as you'd expect from an object creation/deallocation overhead, or is something particularly slow happening?

I heard that (for example) sending four seperate sets of data is much, much slower, than sending one piece of data four times the size. Would I make a significant saving by sending separate packets of data that wouldn't always go together in the same packet when they happen at the same time?

Are there any other bluetooth performance secrets I've missed?

Thanks for your help.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c