The State of JavaScript on Android in 2015 is... poor


(Jeff Atwood) #1

For several years now we’ve tracked the fact that, over time from 2012 onward, Android JavaScript performance has become wildly divergent from iOS JavaScript performance. And not in a good way.

To give you an idea of how divergent it has become, try:

This is the benchmark most representative of Discourse performance, and the absolute best known Android score for this benchmark is right at ~400ms on a Samsung Galaxy S6. That doesn’t seem too bad until you compare…

  • iPhone 5 → 340ms
  • iPhone 5s → 175ms
  • iPhone 6 → 140ms
  • iPad Air 2 → 120ms
  • iPhone 6s → 60-70ms

In a nutshell, the fastest known Android device available today – and there are millions of Android devices much slower than that out there – performs 5× slower than a new iPhone 6s, and a little worse than a 2012 era iPhone 5 in Ember. How depressing.

We’ve done enough research to know this issue is not really specific to Ember, but also affects Angular and most other heavy/complex JavaScript on Android. Why?

Part of it is indeed Chrome/V8 JavaScript optimization issues on Android as you can see from this AnandTech Galaxy S6 review. Note the browser used:

It’s also partly because single core performance on Android is falling way, way behind iOS. Notice that the flagship Android device barely has the single core grunt of an old iPad Mini based on the old A7 core. Compare single core Android GeekBench versus single core iOS GeekBench:

It seems the Android manufacturers are more interested in slapping n slow CPU cores on a die than they are in producing very fast CPU cores. And this is quite punishing when it comes to JavaScript.

This is becoming more and more of a systemic problem in the Android ecosystem, one that will not go away in the next few years, and it may affect the future of Discourse, since we bet heavily on near-desktop JavaScript performance on mobile devices. That is clearly happening on iOS but it is quite disastrously the opposite on Android.

I am no longer optimistic this will change in the next two years, and there are untold millions of slow Android devices out there, so we need to start considering alternatives for the Discourse project.

:warning: Update

We did make significant changes to the Discourse project to work around this issue. See Robin’s blog post for details.


Discourse as Android Application
Accessibility concerns re email, Lynx, JAWS
Do your users ever complain about the speed of Discourse?
Android "slow_platform" per page setting
Print long topic to PDF, redux, again
Print long topic to PDF, redux, again
Discourse mobile slow on 2013 Android phone
(Nukeador) #2

Have you tried with Firefox for Android instead of Chrome? :wink:


(Jeff Atwood) #3

Try it yourself – always slower in my testing.


(cpradio) #4

So what are you considering or what ideas are you throwing around internally? Functional features with Javascript disabled? A dedicated app hitting the Discourse API?


(Jeff Atwood) #5

Hard to say, some of it would possibly be under “let’s present a better minimal rendered experience for ancient devices”. Dedicated native Android app is far beyond our current staff and budget and resource levels. Plus, two code bases, two sets of bugs, two sets of support, etc.

One mitigation I should have mentioned – we already send down half the content to Android devices and have for a year now, so we effectively cut that 5× Android JavaScript performance penalty in half. Which means it is still 2.5× slower :frowning: but more tolerable.


(Alec Joy) #6

This is getting really frustrating for me personally, not just from a developer standpoint but from a consumer standpoint. I love my phone (Moto X 2014) and much prefer Android to iOS but as JS apps are becoming more ubiquitous we’re almost at the point where a (personally) inferior experience on the rest of the device is worth the trade off to have the sites I use and love work well.

We have a discourse forum for our sports site (thesportscollective.co) and many of our writers have been complaining about poor performance of the forum on their older android phones. I don’t WANT to move away from discourse, but if Android performance doesn’t start to improve we may have to since 68% of our active users are on Android devices. At this moment in time, I would support discourse moving away from Ember, even though I think the functionality Ember provides is pretty core to the Discourse experience. It’s just not worth the performance trade off in my mind at this time on such a large segment of our users devices.


(Chrisbrent) #7

But the wouldn’t the “app” just be a browser that worked? Samsung seem to be able to do it, so it is Chrome not being efficient, or is it really that hardware hobbled? This has been an issue for such a long time! How is Google getting away with it, even for Angular!


(Jeff Atwood) #8

Reminder, Angular also has this same performance problem on Android. It’s not specific to Ember. Any complex JavaScript app will exhibit the same problems.

So it’s really about throwing away the JavaScript part of the app, which is challenging since Discourse is a JavaScript app. How do you throw away what you are? You can’t rip out your own skeleton.

Anyway, I agree, the 2013 me said “surely the state of JavaScript performance will improve on Android by 2016”. Sorry 2013 me, things didn’t turn out that way :cry:


(Martín Marconcini) #9

I guess the solution will be for Google (and/or other manufacturers) to license/imitate/copy/reproduce/invent something akin to Apple AX chips.

I think you should change the title to The sad State…


(Alec Joy) #11

Yeah, I understand that. I meant “ditch ember” as in ditch JS app in general. Like you said, it’s a complex issue though. Ditching Ember would be a MAJOR change for discourse and one that, in some ways, takes away a lot of what makes discourse unique to other solutions. But with the ever growing android market share it might be necessary. Maybe “byte code for the web” will save us but who knows when, or even if, that will be supported enough to make a difference.


(Jeff Atwood) #12

The other strategy is to double down on the coattails of Apple, since the company is clearly firing on all cylinders. But as @sam has pointed out, Apple does not play the low cost game, and probably never will.

This would mean Discourse is positioning itself as more of a “premium” solution (read: devices that run JavaScript at near desktop speeds) than an “everyperson” solution (read: zillions of cheap Android devices with 2012 era specs), given the worldwide share of iOS and Apple.

Not super happy with that, but it might be the only viable way forward.


(Jon Koon) #13

Does Discourse do some server side rendering? Does (would) this help?


(Alec Joy) #14

As an android user that would certainly bum me out, but if that’s the best decision for discourse I suppose I can’t encourage otherwise. I’m not familiar with any websites using that strategy though. It’s one thing when company’s make iOS only apps, there’s clear segmentation there, but having a website that just runs like garbage on one platform? I have a feeling users will tend to, as they often do, blame the service first.


(Jeff Atwood) #15

It just means over time you’ll lose Android users as they get fed up with the huge speed disparity (if they care, or notice) but you’ll retain and grow iOS users.

If Apple’s overall market share keeps increasing, this wouldn’t necessarily be a bad strategy. Not my favorite, and not really in harmony with the original vision for Discourse, but I’m limited in what we can do with the resources that we have. We can’t build two distinct applications (web, for iOS, and native, for Android) without destroying the company in the process.

It could also be that over a long time scale (e.g. five years out) Android will fix this. But it clearly will not be fixed in a year or two.


(Jesse Perry) #16

I would argue that actually they do, with their older devices. If you’re comparing on processor speed & ability — the case could be made that Apple’s phones are actually cheaper (3 year old iPhone 5 vs brand new Samsung Galaxy S6).


(Alec Joy) #17

I thought android was still seeing gains in market share though? or is that only on a global scale and US is declining?


(Simon Cossar) #18

It might help to have an HTML mode that was designed to work well on older phones.


(Jeff Atwood) #19

According to figures released [Feb 2015] by Kantar Worldpanel ComTech, iOS accounted for 47.7 percent of all smartphones sold in December 2014 in the U.S. That’s just a notch above Android’s 47.6 percent.

The larger phones helped them a lot. Of course I’ve been saying that for years… I’d expect Apple to dominate over time in the US, particularly given how amazing the latest devices have been. They might do well in Europe too, but I’m not sure.

For the rest of the world, Android will probably win due to low cost.


(Holden) #20

I don’t really know anything about this, but what about creating an Android app? (Of course I’m guessing it would run faster than Discourse in a browser.)

I love Discourse and the direction it’s been going in. It would be a shame to change.


(Alec Joy) #21

Maintaining separate code bases for web, android, and iOS would be a nightmare and generally speaking web traffic is growing faster than app traffic.