Skip to main content

How Facebook made News Feed 50 percent faster on iOS

How Facebook made News Feed 50 percent faster on iOS
How Facebook made News Feed 50 percent faster on iOS

Facebook also rewrote the code for timeline, groups, pages, search and more, but noticed that News Feed got slower with each release.

Facebook’s Adam Ernst, in a detailed blog post, explained that the problem was in the data model layer:

First, let’s talk about how News Feed was designed to work on iOS.
 The Facebook APIs we use serve as a JSON representation of the stories in your News Feed. Because we didn’t want UIViews to consume JSON directly — there are no type safety or hints about what fields you can expect to get from the server — we create intermediate data models from JSON and used those to power the user interface.
 Like most iOS apps, we chose to use the system default framework for managing data models: Core Data. Already built into iOS and very well documented, it allowed us to get the native rewrite out the door without reinventing the wheel.

Returning to our performance problems, though, we found that Core Data had a quirk. As we ported more features, our Core Data database slowed down.
 We started with only a few dozen entities in Core Data, but this had ballooned to hundreds. Some of those entities had a lot of fields — Pages, for example, had more than 100!

Under the hood, Apple’s Core Data framework uses SQLite to store data. As we added more entities and more fields, the number of tables, columns, and indexes grew.

 Core Data stores data in a fully normalized format, so each time we encountered a Pages object in JSON, we would have to perform a fetch-or-create in Core Data and then update the page.

 Saving would touch dozens of indexes in SQLite, thanks to an enormous number of relationships (i.e., how many things reference people or Pages objects on Facebook).

Popular posts from this blog

A Beginner's Guide to Writing a Novel

What makes it hard is not writing itself but how people make it hard than it really is ? No one is born a novel writer. But do you believe that we all have the capability to be writers? Impossible as it may seem but the answer is yes! If we have the passion for it and if we strive to make it happen, novelwriting can be as easy as writing ABC. Writing is actually not a very complicated thing. It is just like drawing, painting, and even cooking. It is an art! Your imagination is all that it takes to get it started. What makes it hard is not writing itself but how people make it hard than it really is. The first key to writing a novel is the ability to dream and imagine. Think back to when you were a little child and dreamed. Your imagination took you to places you've never been before. It made you do things you never thought you could do. Having superpowers...being in strange places...the conditions are limitless. Writing a novel is actually imagination translated into words. You clo...

DoubleClick Search Announces New Google Shopping Campaigns Tools For Retailers

DoubleClick Search Announces New Google Shopping Campaigns Tools For Retailers Today Doubleclick Search launched three new reporting and optimization tools for retailers using the DoubleClick Search Commerce Suite. Designed for Google’s Shopping Campaigns, which take effect on August 31, new Adaptive Shopping campaigns structures product groups based on similar conversion rates. Integrating directly with Google Merchant Center, the tool automatically subdivides existing product groups by product ID based on performance. Google says it has found that 90% of the median advertiser’s cost comes from only 9.5% of its products. Adaptive Shopping Campaigns are designed to isolate high-spending, high-converting products from lower-converting products so that bids can be set separately. Advertisers often lump these high-spend products into bid groups with other, lower-converting products — leading to bid values that are not optimized, based on relative performance. Adaptive Shopping campaigns e...

The Tomorrow Children from 3 games on the PS4 uses the Anti-Alising | video game released

In the coming days for more news from The Tomorrow Children, eighth-generation console exclusive games for Sony PlayStation 4, will be released. After a small delay in the game's alpha was The Tomorrow Children, maker of the game, Q-Games, for her Twitter fans to the game in the next week promised to release more of this game. The constructor The Tomorrow Children also shared a long video of the game. In addition, Dylan Cuthbeat, director of the play, in response to a fan question about the anti-aliasing in the game that had this title, admits the play The Tomorrow Children simultaneous use of three types of anti-aliasing is range. 40 minutes of video game play The Tomorrow Children's manufacturer, Q-Games, is published, you can view or download below. Download video 720 p with size 457 MB Download video 480 p with size 253 MB The Tomorrow Children Play PixelJunk series is the latest project that is being built by the manufacturer.   According to the lates...