Former Google intern explains why UI lag occurs more often in Android than iOS

A former intern for Google's Android team has provided explanations for why Android experiences more touch interface lag than competing mobile operating systems from Apple, Microsoft and Research in Motion.

Undergraduate software engineering student Andrew Munn posted his observations on Google+, as noted byCult of Mac. He did disclaim, however, that he will be starting an internship with Microsoft's Windows Phone team in January, adding that any opinions from the report were his alone.

According to Munn, Android has a difficult time dealing with the touch interface because it handles rendering "on the main thread with normal priority," as opposed to iOS, which treats UI rendering with real-time priority. He cites examples of website loading and the Movies app on Android where the operating system will continue to load while registering touch input.

Munn identified several other factors that contribute to UI lag on Android. For instance, the photo gallery app in either Android 3.0 Honeycomb or 4.0 Ice Cream Sandwich is capped at 30 frames per second in order to prevent a noticeable "hiccup" at 60 FPS.

"Capping the frame rate at 30 fixes the hiccup problem at the expense of buttery smooth animations at all times," he said.

The author also pointed to hardware issues for Android. According to him, Nvidia's Tegra 2 chip limits Android because of its low memory bandwidth and lack of NEON instruction set support. Tablets based on Honeycomb would be "better off with a different GPU," such as the Samsung Hummingbird or Apple A4.

Munn noted that Android "has a ways to go" before achieving more efficient UI compositing, especially when compared against Apple's iOS.

"On iOS, each UI view is rendered separately and stored in memory, so many animations only require the GPU to recomposite UI views," he said. "GPUs are extremely good at this. Unfortunately, on Android, the UI hierarchy is flattened before rendering, so animations require every animating section of the screen to be redrawn."

Another reason for the lag is the limitations of Android's Dalvik virtual machine, which is "not as mature" as a desktop-class Java VM, Munn said. However, the issue with Dalvik will be offset by hardware acceleration from Ice Cream Sandwich on and improvements to Dalvik.

But, in spite of the improvements, Munn believes the Android user interface "will never be completely smooth because of the design constraints" that limit UI rendering to the main thread of an app with normal priority.

"Even with a Galaxy Nexus, or the quad-core EeePad Transformer Prime, there is no way to guarantee a smooth frame rate if these two design constraints remain true," he said. "Its telling that it takes the power of a Galaxy Nexus to approach the smoothness of a three year old iPhone."

According to Munn, the reason behind the design change is that the original Android prototype didn't have a touchscreen, as it was meant to be a BlackBerry competitor. As such, Android's architecture is meant to support a keyboard and trackball. Munn further claimed that after the original iPhone arrived in 2007, Google rushed to complete Android, but "it was too late to rewrite the UI framework."

He cited Windows Mobile 6.5, BlackBerry OS and Symbian as examples of other older operating systems that suffered similar problems with touch performance. Microsoft, RIM and Nokia have all abandoned those OSes in order to start from scratch. "Android is the only mobile OS left that existed pre-iPhone," the report noted.

Android Software Engineer Romain Guy admitted as much when he said that choices made years ago had contributed to work the team has to do now.

"Having the UI thread handle animations is the biggest problem," he said. "We are working on other solutions to try to improve this (schedule drawing on vsync instead of block on vsync after drawing, possible use a separate rendering thread, etc.) An easy solution would of course to create a new UI toolkit but there are many downsides to this also.

According to the report, those downsides include the fact that apps would have to be rewritten to support the new framework, Android would need legacy support for old apps and work on other Android features would be held up while the new framework was being built.

"However, I believe the rewrite must happen, despite the downsides. As an aspiring product manager, I find Androids lagginess absolutely unacceptable. It should be priority #1 for the Android team," Munn said.

UI Lag has long been an area for which reviewers have criticized Android. One recent usability study by Jakob Nielsen on Amazon's Android-based Kindle Fire found erratic scrolling and "huge lag in response after pressing command-buttons." Nielsen suspected that "sloppy programming" was causing the issue.

The New York Times' David Pogue also took issue with the Kindle Fire. "Animations are sluggish and jerky — even the page turns that you'd think would be the pride of the Kindle team," he said in his review. "Taps sometimes don't register. There are no progress or 'wait' indicators, so you frequently don't know if the machine has even registered your touch commands. The momentum of the animations hasn't been calculated right, so the whole thing feels ornery."

Munn himself viewed the issue as damaging to Android's image. He also saw it as a violation of Google's guiding principles, which have generally led to faster, optimized products. Finally, he mentioned that UI lag breaks the direct 1-to-1 relationship that touch screens offer.

"The device no longer feels natural. It loses the magic. The user is pulled out of their interaction and must implicitly acknowledge they are using an imperfect computer simulation. I often get lost in an iPad, but I cringe when a Xoom stutters between home screens," he said.

To conclude, the report ended on a more upbeat note, with Munn voicing his belief that the Android rendering framework is in the hands of a capable team. "I know they will have it eventually," he said.

Funny out pre iPhone is used as a distinction when the iPhone is OS X, which is NeXTStep, which was designed in the 80s.

Certainly Apple designed Cocoa Touch specifically for the iPhone, but much of what is discussed here (i.e. caching object bitmaps) are things NeXTStep 1.0 did correctly. Which enabled things like live scrolling, live window movement, etc on the desktop with the same fluidity as the UI on iOS devices.

And that is one of the main reasons why every Android device has sucked so far. Some pathetic people even go as far as denying that there is any lag on Android. They're either serial liars or they're blind.

On a touch screen device, all user interaction needs to be instantaneous, not seconds after you press something. And everything needs to be smooth, not jerky.

There's also another big thing that Android can not do well, it doesn't handle audio properly, and realtime music apps is something else that doesn't exist on Android, because of the terrible latency.

But he is right, user experience is everything on these devices, so if their GUI framework is not up to scratch, it's needs to be job 1.

It can't be though because it means having to rewrite hundreds of thousands of apps to take advantage of it. Apple made sure to get this right from the start and Google should have too - same with have 32-bit rendering in every part of the OS.

I expect they will correct all the issues over time but the honesty of the engineer speaks volumes:

"Its telling that it takes the power of a Galaxy Nexus to approach the smoothness of a three year old iPhone."

Is there an explanation for the UI lag on iPhone 3G running IOS 4, even with the IOS update that was supposed to address that?

Yes.. the hardware.

Although when I had my 3G I used a jailbroken iOS 4 (with backgrounds and multi-tasking enabled) and didn't find it to be that bad. Periodically it would get a little sluggish and I would use SBSettings to free up some memory.

The cold truth is that the hardware in the iPhone 3G is not really fit for running iOS 4. (It's like trying to run leopard on a G4 with only 1gig of ram. Sure, it will do it... but it will get sluggish on occasion.)

I'm going to be upfront that I'm a non-expert but I think this sounds so similar to the mindset of the folks in Redmond: any time Windows got more complicated and slow the solution was to throw faster hardware at the problem. It's a brute force approach in contrast to careful refining, optimizing, and perfecting.

Android seems similar in that things such as processor type and speed are bandied about in marketing materials like celebrity name dropping at a party. The measure-bators boast about things like GHz and Snapdragon or Tegra or processor du jour. I probably used the wrong names but I don't care: consumers shouldn't need to know this sort of information. Really, it's not the name or speed of the processor that counts but how efficiently those cycles are utilized.

I have an older iPhone, the 3GS. Its processor must be totally obsolete by now - I'm two cycles behind the latest and greatest iPhone. However, there is absolutely no lag on my touchscreen! I've used my friends' Android-based phones and touch-response lag was very distracting.

I like my iPhone because it works well! Android just doesn't seem to be there yet. And if the intern is to be believed it sounds like it's due to some bad choices in the foundation of the Android OS...

I'm going to be upfront that I'm a non-expert but I think this sounds so similar to the mindset of the folks in Redmond: any time Windows got more complicated and slow the solution was to throw faster hardware at the problem. It's a brute force approach in contrast to careful refining, optimizing, and perfecting.

Android seems similar in that things such as processor type and speed are bandied about in marketing materials like celebrity name dropping at a party. The measure-bators boast about things like GHz and Snapdragon or Tegra or processor du jour. I probably used the wrong names but I don't care: consumers shouldn't need to know this sort of information. Really, it's not the name or speed of the processor that counts but how efficiently those cycles are utilized.

I have an older iPhone, the 3GS. Its processor must be totally obsolete by now - I'm two cycles behind the latest and greatest iPhone. However, there is absolutely no lag on my touchscreen! I've used my friends' Android-based phones and touch-response lag was very distracting.

I like my iPhone because it works well! Android just doesn't seem to be there yet. And if the intern is to be believed it sounds like it's due to some bad choices in the foundation of the Android OS...

I like your analogy. In both cases Microsoft and Google made the same mistakes: rush to release something to compete with Apple. (While sacrificing quality along the way)

Imagine what Windows and Android would be like if MS and Google took time to do things right and proper the first time...