How Facebook Sped Up News Feed on iOS

By David Cohen 

NewsFeediPad650News Feed is the starting point for most Facebook users’ journeys through the social network, but it began slowing down on the flagship iOS application due to steps that were taken to speed up other components of the app. iOS developer Adam Ernst explained what steps were taken to quicken the loading of News Feed in a post on the Facebook engineering blog.

Ernst described the issues that began to hold back News Feed delivery:

Our engineering team spends a lot of time and effort making News Feed reliable, simple and fast. Almost two years ago, we switched the Facebook iOS app from HTML5 to native iOS code to optimize performance.

Our work didn’t stop with News Feed. We wanted to bring the same speed to other parts of the app, so in later updates, we also introduced native rewrites for Timeline, groups, pages, search and more. But we began to notice something curious: News Feed was getting slower with each release. With each update, it would take a tiny bit longer for News Feed to load, and it began to add up.

What was going on? To figure it out, we added instrumentation to each step in the process of loading News Feed — network, parsing, data processing, layout calculations and view creation. What we found surprised us — the problem was in our data model layer. With each passing release, the time it took to create and query model objects was longer and longer. Only turning to a brand new model layer would solve the slowdown.

For a thorough look at the process of creating a new data model layer for News Feed on Facebook’s iOS app, please see Ernst’s blog post, which he concluded with:

We used our Airlock system to gradually introduce this new version of News Feed to the public. This framework helped us verify that iOS News Feed was nearly twice as fast under the new framework. Our work won’t stop there, of course — we’ve got more improvements coming, so look forward to an even snappier News Feed soon!

iOS users: Did you notice the slower loading times for News Feed prior to this undertaking, and have you found it to be speedier since?