iDevGames Forums

Full Version: iPhone Game Optimizations. Ultimate Guide
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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.
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.
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.
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)?
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.
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
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
Hey, how is the article-per-week thing going? Smile I'm ready to read some of your stuff if you wrote any.. Cheers
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.
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
Looking forward to reading it.
Same here, would be very interested in reading (and proof-reading, if you want us to!) Smile
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.
Reference URL's