Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Facebook: “Betting on HTML5 Was a Mistake” – Technical Reasons and Reactions

Facebook: “Betting on HTML5 Was a Mistake” – Technical Reasons and Reactions

Leia em Português

This item in japanese

Lire ce contenu en français

Facebook has decided to go native for mobile content instead of doing HTML5 as it was the plan for a couple of years. This article contains technical details behind FB’s move, and reactions from Xamarin and Mozilla.

Mark Zuckerberg, CEO of Facebook, has recently declared during an interview for TechCrunch that “the biggest mistake that we made as a company is betting too much on HTML5 as opposed to native because it just wasn’t there,” and “since we’ve done the iOS app we’ve seen double the amount of feeds people consume.”

Zuckerberg did not say exactly what was their problem with HTML5, but he suggested the quality of such products was not good enough: “There are mobile experiences out there that are so good, that … we need to have the highest quality, and the only way is doing native.”

Tobie Langel, a Facebook software engineer and W3C AC Representative, detailed in a post the performance issues encountered by Facebook while building a mobile web presence based on HTML5. The first problem Langel mentioned was the lack of debugging tools:

The lack of tooling in mobile browsers makes it very difficult to dig down and find out what the real issues are. …

The biggest issues we've been facing here are memory related. Given the size of our content, it's not uncommon for our application to exhaust the hardware capabilities of the device, causing crashes. Unfortunately, it's difficult for us to understand exactly what's causing these issues. GPU buffer exhaustion? Reaching resource limits? Something else? Hard to say.

Langel would like to know the memory usage for heap, objects, GPU buffers, and information on GC cycles, FPS, and other resource limits.

Another issue with HTML5 remarked by Langel was scrolling performance, mostly done with JavaScript because “other options were not fast enough”, noting:

Inconsistent frame rates, UI thread lag (stuttering).

GPU buffer exhaustion due to size of content and number of images.

Native momentum scrolling has a different feel across operating systems. JS implementation end up being tailored for one OS and feels wrong on other ones (uncanny valley).

Perf issue with touch events on Android devices (latency, not enough events) which makes JS implementations of scrolling more brittle there.

Other issues mentioned by Langel were: the GPU, which comes as “a black-box”, the need for better touch tracking support on Android, smoother animations, and better caching. Some of these issues have already been submitted to the W3C Web Performance WG.

In a comment for InfoQ, Nat Friedman, CEO of Xamarin, maker of tools for building cross-platform native apps, welcomed Facebook’s move: “This shift to embracing native experiences is a great thing for the entire mobile ecosystem - device manufacturers, app publishers, and most importantly, consumers.” He also noted that it is too early for mobile standards to emerge:

Mobile innovation is still moving at lightening speed, far outpacing the velocity that a  ‘standards’ approach can ever achieve.  Historically when a new OS is introduced, the capabilities are so new that the only way to exploit them is at the OS level.  The best apps and the most ground-breaking innovation at this stage therefore happen very close to the OS.  This dynamic is very true for the current mobile device platforms.  The race for market share is driving a tremendous amount of change and innovation at the device operating system level.  Over the next several years, these operating systems will stabilize and innovation will slow at this level, making a standards approach more feasible.  But this will take several years.

Brendan Eich, the CTO of Mozilla, an organization betting on web technologies, has a different take on Facebook’s failure with HTML5, according to ZDNet:

If you read between the lines, what it seemed he [Mark Zuckerberg] was saying is what they tried to do was hybridize native and HTML, and when you do that there's always a seam between the systems. A friend of mine, Joe Hewitt, used to be at Facebook and did the first hybrid app and did a very good integration. But he left, and the skill required to keep that seamless — and possibly some of the support from Apple to do it — weren't there in the later versions.

Eich is confident that the web will eventually win:

I don't think the web ever loses. It's just a matter of pragmatics and spin that you get into with these things. …

Companies like Facebook can afford to do a native [app], especially on iOS. But for the long tail, developers will generally do the web and often be content there.

If the web can be evolved to include the missing APIs and have better performance, [developers] won't need to go beyond the web. …

I have a feeling the web will be pretty darn good [10 years from now], and you won't have this tension between native versus web that we're endlessly debating these days.

Matt Asay, an editor for The Register, quoted an unnamed Facebook engineering manager saying on the native vs. HTML5 controversy:

Right now Facebook moves fastest by writing native code. This isn't to say HTML5 won't ever be able to live up to the hype, but just that at this point Moore's Law and the web engines still have some ways to go. So we made a pragmatic decision. Eventually if HTML5 lets us move faster you could expect to see us move back to it. We are going to use whatever tech stack lets us do high-quality work at a fast pace.

Mark Zuckerberg also thinks HTML5 is promising on the long-term:

And it’s not that HTML5 is bad. I’m actually, on long-term, really excited about it. One of the things that’s interesting is we actually have more people on a daily basis using mobile Web Facebook than we have using our iOS or Android apps combined. So mobile Web is a big thing for us.

Facebook released a native app for iOS in August and they are preparing a similar one for Android which is supposed to hit the Google Play store soon.

Rate this Article