Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411711 Posts in 69403 Topics- by 58457 Members - Latest Member: FezzikTheGiant

May 20, 2024, 07:06:52 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Speed up your iPhone game - disable "Thumb"!
Pages: [1]
Print
Author Topic: Speed up your iPhone game - disable "Thumb"!  (Read 5235 times)
X3N
Level 6
*


View Profile
« on: January 09, 2010, 08:18:08 PM »

http://gamesfromwithin.com/break-that-thumb-for-best-iphone-performance

Thanks to

Speaking of performance, have you done the disable thumb generation trick?  Huge floating point speed gains for me.  I wish I had known about it earlier.

in http://forums.tigsource.com/index.php?topic=8648.0 (Hook Champ)
Logged

destiny is truth pre-op
Golds
Loves Juno
Level 10
*


Juno sucks


View Profile WWW
« Reply #1 on: January 09, 2010, 09:37:50 PM »

YOUR GAMES SHALL ALL RUN LIKE BUTTER.
Logged

@doomlaser, mark johns
mcc
Level 10
*****


glitch


View Profile WWW
« Reply #2 on: January 09, 2010, 11:32:51 PM »

I'm in the middle of profiling/optimizing my iPhone app right now and here's a piece of advice TheBunny on freenode #iphonedev gave me months ago, but I only just now tried, and it helped more than a ton of much more sensible optimizations I did (though not as much as disabling the accursed Thumb did):

Set your scheduledTimerWithTimeInterval to 1/200 or 1/500 or something, even though what you want is 1/60. If you tell the timer mechanism you want to run at 60 FPS, you will run at about 50 FPS. If you tell it you want to run at 200 FPS, you will run at 60 FPS. I have no idea why this works but it does.

EDIT: It turns out this advice is not correct anymore since Apple released 3.1! In the 3.1 SDK there is an object called "CADisplayLink" that can give you a callback specifically when the display is ready for refresh. I have not used this yet but I'm told it is more accurate than the timers, and anyway the overwhelmed-timer trick I describe above has some bad side effects (potentially occasionally dropped events). Whoops.

----

You know what I very badly want to know but still have no idea, is how the hell do you use the VFP / vector unit.
« Last Edit: March 19, 2010, 08:22:51 AM by mcc » Logged

My projects:<br />Games: Jumpman Retro-futuristic platforming iJumpman iPhone version Drumcircle PC+smartphone music toy<br />More: RUN HELLO
resistor
Level 0
**


View Profile
« Reply #3 on: January 11, 2010, 10:03:27 AM »

(though not as much as disabling the accursed Thumb did)

It's not evil.  In fact, it serves the very important purpose of generating much smaller, denser code, at the cost of performance (particularly floating point).  For things that aren't performance critical, it's a really good thing.

Quote
You know what I very badly want to know but still have no idea, is how the hell do you use the VFP / vector unit.

http://code.google.com/p/vfpmathlibrary/

or be prepared to learn some inline assembly. ;-)
Logged
mcc
Level 10
*****


glitch


View Profile WWW
« Reply #4 on: January 11, 2010, 07:00:43 PM »

It's not evil.  In fact, it serves the very important purpose of generating much smaller, denser code, at the cost of performance (particularly floating point).  For things that aren't performance critical, it's a really good thing.

Yeah, I dunno. This thing has like 4 GB of disk space on the low end and there's no cost to executable size until you hit 10 MB, a ceiling you're unlikely to reach by machine code alone. RAM is in similar abundance. In offhand testing the gain I see from switching on thumb is quite small relative to numbers like "10 MB", and really is on the scale that could easily be overwhelmed with a couple of PNGs or even by just making enough nibs.

The reason code space optimizations are generally preferred these days are that space optimizations are really performance optimizations-- space optimization means smaller code blocks, smaller jumps and better performance on the cache. But that justification doesn't really work if your space optimization is going to overwhelm this effect with an active performance hit.

I guess maybe is the idea that you get a net performance gain using thumb on for apps with little or no floating point code? I don't know. I'm sure there's someone somewhere thumb is right for but I'm really having trouble justifying Apple making that setting the default.

Quote
You know what I very badly want to know but still have no idea, is how the hell do you use the VFP / vector unit.

http://code.google.com/p/vfpmathlibrary/

or be prepared to learn some inline assembly. ;-)

[/quote]

Hm, so I've got the google code vfp library but the vfpmath library itself is a bit cryptic and doesn't seem to come with any documentation. Is there a guide to using vfpmathlibrary you would recommend? Alternately, is there any reading you'd recommend for someone interested in going ahead and interacting with the vfp via assembly? I've just in general had trouble finding documentation on this stuff. Thanks...
Logged

My projects:<br />Games: Jumpman Retro-futuristic platforming iJumpman iPhone version Drumcircle PC+smartphone music toy<br />More: RUN HELLO
resistor
Level 0
**


View Profile
« Reply #5 on: January 12, 2010, 12:22:28 AM »

I guess maybe is the idea that you get a net performance gain using thumb on for apps with little or no floating point code? I don't know. I'm sure there's someone somewhere thumb is right for but I'm really having trouble justifying Apple making that setting the default.

The idea is that you get a negligible performance loss (on the order of a few percent) on non-FP code, and significant power savings because parts of the chip can be turned off in Thumb mode, in addition to other power savings from less bus traffic, etc.  Given that Apple wants to encourage developers to conserve space and power, it makes sense that the compiler optimizes for that unless you tell it otherwise.

Quote
Hm, so I've got the google code vfp library but the vfpmath library itself is a bit cryptic and doesn't seem to come with any documentation. Is there a guide to using vfpmathlibrary you would recommend? Alternately, is there any reading you'd recommend for someone interested in going ahead and interacting with the vfp via assembly? I've just in general had trouble finding documentation on this stuff. Thanks...

Not really, unless you're up for read the ARM reference manual.
Logged
mcc
Level 10
*****


glitch


View Profile WWW
« Reply #6 on: January 12, 2010, 08:58:06 AM »

Ah, power savings make sense.
Logged

My projects:<br />Games: Jumpman Retro-futuristic platforming iJumpman iPhone version Drumcircle PC+smartphone music toy<br />More: RUN HELLO
dortimus
Level 0
*


View Profile WWW
« Reply #7 on: March 02, 2010, 12:11:38 AM »

Given that Apple wants to encourage developers to conserve space and power, it makes sense that the compiler optimizes for that unless you tell it otherwise.

I just started learning about the iPhone SDK and, interestingly enough, all this thumb and 16-bit/32-bit switching is mentioned in the "Getting Started Videos" at http://developer.apple.com/iphone.

The video that mentions this is the "Key Practices for iPhone Development" video (you'll need a free Apple dev account and iTunes to view it).  The info about Thumb is about 7 minutes in, and their primary reason for it is reducing the memory footprint (a reported 35% savings).
Logged

X3N
Level 6
*


View Profile
« Reply #8 on: March 08, 2010, 06:44:25 PM »

Given that Apple wants to encourage developers to conserve space and power, it makes sense that the compiler optimizes for that unless you tell it otherwise.

I just started learning about the iPhone SDK and, interestingly enough, all this thumb and 16-bit/32-bit switching is mentioned in the "Getting Started Videos" at http://developer.apple.com/iphone.

The video that mentions this is the "Key Practices for iPhone Development" video (you'll need a free Apple dev account and iTunes to view it).  The info about Thumb is about 7 minutes in, and their primary reason for it is reducing the memory footprint (a reported 35% savings).

Totally skipped those videos..  Roll Eyes
Logged

destiny is truth pre-op
dortimus
Level 0
*


View Profile WWW
« Reply #9 on: March 11, 2010, 12:44:22 PM »

Totally skipped those videos..  Roll Eyes

Yeah, I don't normally read (or view) the documentation either.  In my experience, though, Apple has consistently good software documentation.  I worked with QuickTime a long time ago, and the documentation for that was great.  The iPhone docs are just as good.  And since Objective-C is Steve Jobs' little baby, they've got a lot of documentation on that as well (good for me since I'm new to Objective-C).

tl;dr The Apple iPhone SDK docs are really good.
Logged

oahda
Level 10
*****



View Profile
« Reply #10 on: March 19, 2010, 06:44:03 AM »

This should be a sticky.
Logged

TimCloss
Level 0
*


View Profile
« Reply #11 on: March 24, 2010, 07:02:01 AM »

Anyone interested in squeezing performance from their iPhone game should check out Airplay SDK:
http://www.airplaysdk.com

Airplay SDK provides its own code building toolchain, so you aren't restricted just to the Apple ARM compiler. You can also use both GCC and ARM RVCT, the latter being the highest-performing compiler around, certainly beating the Apple compiler in both speed and code size.

You can also develop in vanilla C++, test ARM code on the desktop, deploy and sign iPhone apps all on a PC!



Logged
X3N
Level 6
*


View Profile
« Reply #12 on: March 31, 2010, 07:59:08 PM »

tl;dr The Apple iPhone SDK docs are really good.

I was really confused when I first read the documentation because all of the method names were so verbose/descriptive, it looked to me like they were saying theNameOfDesiredResult and some kind of http://www.catb.org/jargon/html/V/voodoo-programming.html.

And lol @ the sticky response. Maybe in an iPhone dev tips thread.
Logged

destiny is truth pre-op
Jason Bakker
Level 2
**


View Profile WWW
« Reply #13 on: April 01, 2010, 05:13:23 AM »

As far as I can tell, in XCode 3.2 at least there is an option for turning it off. In your project settings, it's under GCC 4.2 - Code Generation, called "Compile for Thumb". By default it seemed like mine was unchecked in debug and checked in release. I haven't seen a huge increase in performance in release by turning it off, although at the moment my game isn't doing much. (It will be after this collision rewrite though!)
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic