One of Android’s biggest downfalls is the occasional lag throughout the UI. I’ve been using Android on and off (more on than off) since the release of the G1, and there’s no denying the lag exists. It has gotten better over the years, but nonetheless, it always seems to pop up when you least expect it. And unfortunately for perfectionists, it just may never go away.
Ex-Google intern Andrew Munn has taken to Google+ to unleash some knowledge on how Android works in relation to similar operating systems. More specifically, why Android will always experience shudder unless something radical is done.
You see, according to Munn, the way Android renders the user interface differs from other similar platforms. Android doesn’t prioritize UI rendering, it occurs on the main thread of an app, with no priority exceptions.
Munn breaks it down like so:
Android follows the traditional PC model of rendering occurring on the main thread with normal priority.
This is a not an abstract or academic difference. You can see it for yourself. Grab your closest iPad or iPhone and open Safari. Start loading a complex web page like Facebook. Half way through loading, put your finger on the screen and move it around. All rendering instantly stops. The website will literally never load until you remove your finger. This is because the UI thread is intercepting all events and rendering the UI at real-time priority.
If you repeat this exercise on Android, you’ll notice that the browser will attempt to both animate the page and render the HTML, and do an ‘ok’ job at both. On Android, this a case where an efficient dual core processor really helps, which is why the Galaxy S II is famous for its smoothness.Andrew MunnGoogle+
The way iOS handles UI rendering is still being hashed out in the original source for this information (apparently developers have to implement this kind of behavior, it’s not as simple as Munn originally laid out), but the comparison and Android’s behavior still stand.
Things like better processors and hardware acceleration will help going forward (despite what Dianne Hackborn says), but unless UI rendering is changed, the lag will theoretically always be there.
At this point you may be wondering why developers don’t change this and prioritize rendering. Essentially, Android would have to be completely rebuilt, causing problems all across the board. Not only would developers have to abandon any new features being worked on, but some sort of legacy mode would have to implemented since any currently available apps wouldn’t work anymore.
There a short list of four or five other things Android could do in order to alleviate any problems with lag, but again, UI rendering is the number one problem that needs to be addressed.
On the bright side, developers working for Google, like Romain Guy, are constantly looking for ways to get UI rendering in shape. It’s going to be a long process, but Google has some of the brightest developers working under their roofs. If anyone can get it done, they can.