Facebook Takes Mobile App Native For Speed - InformationWeek
06:14 PM
Connect Directly
[Cybersecurity] Costs, Risks, & Benefits
Feb 28, 2017
How much should your organization spend on information security? What's the potential cost of a ma ...Read More>>

Facebook Takes Mobile App Native For Speed

Facebook remains under pressure to prove that its social network will thrive as much on mobile devices as it has on desktop computers

Stung by user contempt for its sluggish iOS app, Facebook has turned away from the Web technology it once celebrated and toward native iOS code. The result is a much speedier version of its mobile app.

"Facebook 5.0 for iOS is twice as fast as the previous version when launching the app, scrolling through news feed and opening photos in feed," said Facebook product manager Mick Johnson in a blog post on Thursday.

Users have already noticed. A recent review of the app posted under the name Neil Lucia notes, "This newly rebuilt version is a great improvement and runs very smoothly, and the layout of [the] profile page has also changed, for the better!"

Facebook remains under pressure to prove that its social network will thrive as much on mobile devices as it has on desktop computers. Lack of a coherent mobile strategy has contributed to the company's stock woes and to its decision to acquire mobile photo sharing service Instagram. An enthusiastic reception for Facebook 5.0 for iOS could help the company regain its stride.

Johnson says that Facebook engineers "rebuilt the app from the ground up" to make it launch and load content faster. Much of the app is now written in native iOS code, Objective-C, primarily for the sake of speed.

This is being seen as a rejection of HTML5, a Web technology that was hyped too soon and has since seen early adopters moderate their initial enthusiasm. Facebook itself has been one of the more vocal boosters of HTML5.

[ Read Tent Promises Open, Distributed Social Networking. ]

"We have high hopes for HTML5 and have already begun to use it in our products," noted Facebook engineering manager David Recordon in early 2011. "We hope HTML5 will help developers everywhere address one significant engineering challenge we face daily: the need to support different platforms across the Web, desktop and mobile devices."

The company's HTML5 developer webpage still proclaims, "Build the Future with HTML5."

However, Facebook 5.0's speed gain isn't simply a matter of turning to native code. As engineer Jonathan Dann explains in a separate blog post, the revised iOS app is faster not only because there's less use of HTML5, which had been used for various modules inside of an Objective-C wrapper, but also because Facebook has stopped using Three20, an open source Objective-C library that it had been developing since the early days of the iPhone.

"The new Facebook for iOS marks our first release in years without the Three20 framework," said Dann.

In addition, Facebook's iOS app has benefited from more efficient coding. As Dann explains, this involved moving computationally intensive tasks off the main thread, to be processed in the background, so the main thread can handle touch events and other user interactions immediately. In another instance, Facebook engineers found that calculations to layout text on the app display page created a bottleneck. So they shifted to downloading new text strings and calculating their sizes for layout asynchronously while caching text frames for later display.

Facebook does not address what aspects of HTML5 slowed down previous versions of its mobile apps the most, but one reason for the lack of speed should be laid at the feet of Apple rather than Facebook. To display Web content in a native iOS app--a Facebook timeline, for example--a developer typically uses the UIWebView element. But Apple, as a security precaution, will not let UIWebView access its Nitro JavaScript engine, which accelerates the processing of JavaScript. As a consequence, Facebook's old iOS app processed JavaScript more slowly than a Web app viewed through mobile Safari.

In any event, the new Faceook app for iOS may mark a shift away from HTML5 for certain tasks, but it's not a repudiation of the technology. In fact, the app will continue to use HTML5. "For areas within the app where we anticipate making changes more often, we will continue to utilize HTML5 code, as we can push updates server side without requiring people to download a new version of the app," explains Dann.

Comment  | 
Print  | 
More Insights
Newest First  |  Oldest First  |  Threaded View
User Rank: Ninja
8/24/2012 | 5:31:14 PM
re: Facebook Takes Mobile App Native For Speed
Hey Facebook - here's an idea - let us SHARE stories and links from our friends on our iOS and Android apps. It's easy to do on Windows\OSX but not in mobile apps. I can't think of a good reason to have left it out.

If you are trying to capture mobile space, duplicate the experience from PC to mobile.
How Enterprises Are Attacking the IT Security Enterprise
How Enterprises Are Attacking the IT Security Enterprise
To learn more about what organizations are doing to tackle attacks and threats we surveyed a group of 300 IT and infosec professionals to find out what their biggest IT security challenges are and what they're doing to defend against today's threats. Download the report to see what they're saying.
Register for InformationWeek Newsletters
White Papers
Current Issue
Annual IT Salary Report 
Base pay for IT professionals has remained flat this year with a median annual salary of $88,000 for staff and $112,000 for management. However, 58% of staff and 62% of managers who responded to our survey say they're satisfied with their compensation. Download this report to find out which positions earn the highest compensation.
Twitter Feed
InformationWeek Radio
Archived InformationWeek Radio
Join us for a roundup of the top stories on InformationWeek.com for the week of November 6, 2016. We'll be talking with the InformationWeek.com editors and correspondents who brought you the top stories of the week to get the "story behind the story."
Sponsored Live Streaming Video
Everything You've Been Told About Mobility Is Wrong
Attend this video symposium with Sean Wisdom, Global Director of Mobility Solutions, and learn about how you can harness powerful new products to mobilize your business potential.
Flash Poll