iPhone Game Optimizations. Ultimate Guide

Apprentice
Posts: 8
Joined: 2009.11
Post: #1
I made a ppt presentation, where i described a lot of optimization best practices. Almost everything i know.
You can find it here.
Feel free to post your proposals, bug reports and feedback Wink
P.S. English isn't my native language, so i will be thankful any comments about my writing style
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #2
Very nice set of slides. Some stuff in there I had never heard before.

Although I'd like to add about the GLKit math stuff that the issue isn't that it passes matrices and such by value, but the way it does them. Passing things by value to inline functions is normally fine and usually better than passing by reference as the compiler usually optimizes away the storage for the arguments. They either end up exclusively existing in registers when the function is inlined or having folding and constant propagation applied to them (even better). I've gotten a little "lazy" because of this, and the assembly output shows that the compiler generally knows what to do without me needing to hand simplify matrix multiplications for it.

The issue with the GLKMath stuff is that the *first* thing any of those functions do is to take the address of the arguments so it can cast them from it's own type to the NEON types. (/me facepalm) Thereby ensuring that the code has to keep pushing the values in the registers onto stack and read them back again constantly. You can see it in the assembly.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Apprentice
Posts: 8
Joined: 2009.11
Post: #3
The other problem in GLKMath i found, was in Matrix4ByVector4 multiplication - it did modified original matrix.

(Oct 9, 2012 06:32 AM)Skorche Wrote:  Passing things by value to inline functions
inline newer guaranties you, that this function will be inlined, it's only a hint for the compiler. So i doubt, that big functions, like Matrix4ByMatrix4 will be inlined. And this is very common operation. You can force compiler to inline function, using __attribute__((always_inline)).

Anyway. Thanks for your feedback! I have some more ideas to add to this material. Will see, when i'll have a time.
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #4
That's possibly true. In my case I was doing 2x3 matrices for 2D vector rendering stuff. Clang was inlining and folding those quite nicely.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
⌘-R in Chief
Posts: 1,265
Joined: 2002.05
Post: #5
It appears these slides are for a talk. Where was this talk presented? Is there a video?

Would you be interested in writing an article covering each of the points in these slides (or at least the top 10)?
Quote this message in a reply
Apprentice
Posts: 8
Joined: 2009.11
Post: #6
I did a talk for one local company, that do develop a software for iPhone. There are no video, however, the talk was not in English Smile
You are not a first person, that asks me to write an article on all this stuff. I think, i'll be writing an article (every weekend), that will cover one (or two) slides with demo code.

P.S. If you'll help to spread the world, and more people will ask to write an article, that covers some particular slides, the more motivation i'll have to do this -> it takes much of the time and i do really have no time + i'm not good at writing stuff.
Quote this message in a reply
⌘-R in Chief
Posts: 1,265
Joined: 2002.05
Post: #7
Write it and they will come. Wink

You may have a tough time finding "enough" people interested before you actually write it, but if you write it and we post it here, there will definitely be many people that find, read, and appreciate it.

What you write doesn't need to be a masterpiece from the start. That's where copy editors (AKA us) come in to correct typos, make the necessary changes to make the text clearer, find inaccuracies etc.

Start with one and see how it goes. Smile
Quote this message in a reply
Apprentice
Posts: 8
Joined: 2009.11
Post: #8
SethWillits, thanks for your support! I will devote some time at this weekend to write article about the most important optimization method - NEON code vectorization
Quote this message in a reply
Member
Posts: 93
Joined: 2008.11
Post: #9
Hey, how is the article-per-week thing going? Smile I'm ready to read some of your stuff if you wrote any.. Cheers

TapMania - iPhone StepMania // Human knowledge belongs to the world!
Quote this message in a reply
Moderator
Posts: 387
Joined: 2002.08
Post: #10
Dimka, it would be really great to see an article from this! Start simple, and there are people here at iDevGames that will help you clean it up and make a great article. I know I'm definitely interested in learning about these optimizations, and many people in my local iOS developer group would be, too.

KB Productions, Car Care for iPhone/iPod Touch
@karlbecker_com
All too often, art is simply the loss of practicality.
Quote this message in a reply
Apprentice
Posts: 8
Joined: 2009.11
Post: #11
I wrote an article on code vectorization, but that turned out to be a really massive work. It does need some updates. I will try to publish it this weekend
Quote this message in a reply
⌘-R in Chief
Posts: 1,265
Joined: 2002.05
Post: #12
Looking forward to reading it.
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #13
Same here, would be very interested in reading (and proof-reading, if you want us to!) Smile
Quote this message in a reply
Nibbie
Posts: 2
Joined: 2013.10
Post: #14
iPhone game optimization is very good for iPhone app developer who want to optimize their iPhone game through some good tips. You have shared nice slides for iPhone game optimization, but as per the best suggestion concern you need to follow some SEO activities.
Quote this message in a reply
Post Reply