When the 3GS came out, I bought an iPhone 3G. What!? Why on Earth would I do that as a developer? Simple…
I wanted to make sure I got my hands on the machine that had the smallest amount of RAM and the slower CPU. All developers should really do the same. The problem with the 3GS, just like the Pentium processor when it first appeared, and the advent of DDR/DDR2 and DDR3 – it makes developers lazy.
When I started out doing software development, you had CPUs measured in Hz and RAM measured in Bytes. You had to make sure you used the system wisely to make sure your application ran properly. That meant optimising your code and ensuring you didn’t have any leaks in the code.
Fast forward to the modern day. Who cares if my application uses that extra 1 Megabyte of RAM? Well I do. RAM and CPU are precious resources and that is so true on small UNIX devices such as the iPhone. You’re competing against other processes such as the Phone.app, Messaging, iPod and Safari which all run in the background.
On the older 2G/3G devices, this leaves you with <10MB of RAM. On the 3GS you get left with 70+MB! What should you code for? Well the fact that there are still so many 2G/3G devices out there, your iPhone application MUST work in the <10MB scenario. You can’t get lazy just because you’re debugging in the simulator or on the 3GS where you have ample resources.
To get maximum exposure for a non-game app, I put the following rules in place for myself:
- Must use < 10MB of RAM
- CPU usage should be as close to 0 and not over 30% during loading
- Any network traffic should be compressed and minimal so that GPRS transfers are still feasible
- Don’t use splash screens, use the Apple guidelines for the startup PNG file (i.e. your UI!)
Is that so unreasonable? Ok, so if you need RAM, the iPhone can kill things in the background, granted – but that slows YOUR application down while it does it. Also, when the user presses the Home button to leave, the wizzy animation doesn’t work.
You’re making a first impression on your user that just, maybe, paid money for your application. Being slow to start, or even appearing slow to start, is going to get you lots 1 star reviews very quickly. Hardly fantastic marketing is it? There are lots of examples of this all over the App Store – including some of the ‘Top Paid’ apps. They end up recommending people reboot their phone before using their app!? What? Really? That’s insane.
Optimise, debug, make sure you use asynchronous network communications and most of all, test your application on a SLOWER device. Keep those iPhone 3G devices to hand and use them as your primary debug phones.