views:

1531

answers:

4

Something I've noticed about every iPhone app I've tried is that they all have places where they seem very slow and unresponsive. It's true of the games, the free apps, the pricy, popular, "professional" apps, and even a couple of Apple's built-in apps. They all seem to have places where they take many seconds or even a minute to respond to screen touches; bog down and show a spinning beachball for seconds at a time; "queue up" input so that a button press appears to ignored only to actually do something ten seconds later like a poorly made DVR; and lock up for so long that the OS watchdog just kills them.

Because these perf issues are so widespread it seems to me that there must be some common performance pitfalls some system gotchas that are coming up over and over again for lots of different people. I'm not an iPhone developer myself, so I'm canvassing the community's opinions:

What are the most common performance mistakes on the iPhone?

Or, what human factors of iPhone development make it too easy to ship with poor performance?

+2  A: 

Memory management is a bit of a beast.

But I think the biggest problem is this: How long can you afford to polish a product that will sell for 99 cents and compete with tens of thousands of other apps and has unknown revenue potential in a rapidly changing market?

The iPhone is a GREAT little device, but the competition for mindshare is fierce and expensive.

Nosredna
Wow, what a great link to a shocking revelation. Thanks!
Crashworks
Just look at how many of the iPhone questions here on Stackoverflow are about finding memory leaks. It takes a while for C and C++ programmers to get the hang of Objective-C (a lot of Cocoa to learn, mostly--the language isn't that big). And I bet many programmers are in the habit of relying on garbage collection.
Nosredna
Well C/C++ is not html ... or java ... developers can't survive without knowing some basics of how to deal with memory, devices have finite amount of resources be it CPU, RAM or battery life ...
stefanB
+1  A: 

I think the biggest issue is that it's impossible to determine the speed of an app without actually running it on the device. Developers perform most of the basic app testing in the iPhone Simulator (which can run up to 1000x times as fast in my experience). Some operations that take a split second in the simulator might require a progress indicator on the phone, and by the time you realize, it would require a lot of effort to go back and add (and in some cases thread) the operation in question. As Noshredna pointed out, it's generally a 99c app.

The iPhone's processor is also just fundamentally limiting. I've seen several nice looking apps that try to do very impressive things without accepting the constraints of the platform.

This is sort of a side note, and I don't want to start the mobile platform wars, but I've found that iPhone Apps are generally more responsive than Android apps...

Ben Gotow
Once I started testing on the device, I found that I only rarely went back to the simulator. maybe that depends on how much you rely on some things the simulator doesn't do at all.
Nosredna
I'm not sure how far I buy the "iPhone procesor is slow" argument. The PlayStation 2's processor was a 300MHz MIPS compared to iPhone's 620MHz ARM, and those apps responded to everything in 33.3ms or less.
Crashworks
That's true the playstation had a memory bus that could pull almost 3GB a second, though - I wonder if that made a difference? You're definitely right. Compared to the iPhone, they did some amazing things with the limited resources.
Ben Gotow
Yeah, but the iPhone retains a lot more control of the HW than the other platforms. In the gaming consoles, you have basically full control over the device's HW. With the iPhone, you are second-rate citizen to the OS.
Erich Mirabal
I was on some PS2 products. On PS2 games, multiple programmers worked at low level on the multiple funky programmable pieces to gain framerate on products which had long development cycles. And there were low-level libraries built up over the lifetime of the PS2. There were multiple artists optimizing their textures. How many man hours in a typical PS2 game compared to a typical iPhone game? The iPhone's OpenGL ES is fast. But all the tricks have not been found and spread yet.
Nosredna
iPhone's 3G processor is underclocked at 400Mhz (probably to improve battery life)
Marco Mustapic
+1  A: 

As mentioned before the ratio of profit/time spent in development would explain it.

More technically, I would say that the lag you see is created on startup when apps are either getting data over network or calling home to check for updates and so on. Additionaly it may be created with initializing application like loading large amounts of data from database/files, loading gui components and images, drawing and so on.

Similar to memory management this all can be solved by designing operations to run in background, lazy loading and so on but that requires more time, time is money, you don't get much for 99C app which may or may not sell at all.

It is interesting that so many times it is pointed out in professional articles (no ref...) that we should not care anymore about memory and speed because desktops are getting faster with more memory. What people tend to forget is that at the same we're trying to squeeze more power from smaller and smaller devices that are running with smaller resources.

Most web pages for example are nowadays designed to load huge amounts of animations and images and, unlike some, are not tweaked at all for performance but do just okay on desktops. Those web pages have no chance of loading on mobile device. The same goes for applications, designing a fat big framework (or gui widget library) for desktop will make it ultra difficult to port the functionality to sleek mobile device be it iphone, some fruit berry and what not.

As in other things in life, you get what you paid for.

My 99C.

stefanB
+5  A: 

I think that the performance issues are a matter of perception. Apple has employed animation throughout every aspect of the iPhone's interface, which produces the impression of a smooth, responsive device. The slowdowns you refer to appear much worse than they might be because they stand out from the otherwise fluid interface. If you compare the total execution times of these tasks to similar applications on other mobile devices, I'd guess that the iPhone implementations would still come out near the top.

There's always room for improvement, though, and I'd expect that many of the tricks people have learned in the last year will lead to faster, more responsive applications. Even the development tools themselves are advancing, and that should make it easier to diagnose and deal with performance bottleneck. I know I keep learning new tricks every week for squeezing a little more out of the CPU, GPU, or onboard memory.

I'm still surprised by how quickly people have shifted their expectations as to what handheld devices can do. I'm the author of an open source application called Molecules, which does 3-D molecular modeling on the iPhone. A little over ten years ago, these types of renderings were being done on dedicated SGI Irix workstations. A few weeks after the launch of the App Store, I started receiving emails from people complaining that the application was a little jerky when they tried to manipulate molecules with over 20,000 atoms in their structure. In a very short time, people went from treating these devices like phones and music players to viewing them as portable computers.

Brad Larson
The trouble is that the iPhone really does present itself as a mobile computer, with a variety of apps that do things clearly beyond a telephone. Besides, even in mobile devices, I see much better responsiveness and throughput from, say, a PSP, which has half the CPU power.
Crashworks
Sure, now it's easy to look at it as a computer, but how many people thought that way before the launch of the App Store? As far as the PSP, you're not comparing apples to apples. Have you tried to use the PSP web browser? It's much slower and less capable than on the iPhone. Most of what you see are 3D games, and the PSP has dedicated hardware that pushes ~50 times the number of triangles that the iPhone does. For non-game tasks, the PSP is nowhere near as capable as the iPhone. Good luck publishing for it, too.
Brad Larson