Ask HN: How is Facebook's iOS app 491MB?

201 points by x0054 ↗ HN
This is just insane. Photoshop takes less space than that, most fully functional desktop apps take less space than that. If you work for FB, or know someone who does, can you enlighten us as to what in the hell is in that HALF a GB (!!!) app?

158 comments

[ 2.7 ms ] story [ 229 ms ] thread
iOS can't handle their scale
Nope, considering that their app loads fine on most iOS devices…
New Moore's Law: Every year Facebook's iOS app doubles in size.
Thanks for that link. All the defenders of Facebook should read it.

This was gold:

@interface FBSearchModule : FBNativeAppModule_DO_NOT_USE_OR_YOU_WILL_BE_FIRED

Somehow it me feel better about the things I produce.

Honestly I think it's funny and I appreciate a sense of humor from coworkers.
I'm not disparaging it.

Heck, I've got a debugging routine I use on one of my projects that's called panic_on_the_streets_of_london().

Facebook is not good at mobile. Uninstalling the app is the single best thing you can do for your phone battery life.

Just use the mobile site with safari. It’s blazing fast and doesn’t slurp your address book or location and drain your battery.

Or just disabling background updates for the app.
I noticed iOS still reports massive battery use with background refresh disabled.
Hmm... I rarely open Facebook and it doesn’t show up near the top of my battery usage charts. Odd.
In theory that would help, but Facebook appears to use all kinds of "clever" (dirty) tricks to stay running to slurp all that beautiful metadata up.

I've had "background updates" disabled every since the option became available in iOS, and location updates only when i use the app, and yet somehow Facebook manages to stay running in the background for 3x longer than it's been on screen.

We're talking 10 minutes on screen and 30-40 minutes of background activity. I realize some of it is notifications etc, which would trigger background activity, but that can hardly explain all of it.

After watching Facebook eat 30% of my battery every day, i finally uninstalled it and use the mobile interface. Besides making by battery last a whole day longer between charges, it also has the added benefit of not receiving notifications, meaning less stuff to disturb me.

Really bizarre, I don't have that problem at all. It doesn't even make a dent in my battery charts (when compared to things like Phone).
Uninstalling it is the best thing you can do for YOUR life!
The fact that so many people on HN, people who should know the best how malicious this company and their business model is, are still using FB is worrying. How are normal people supposed to quit?
I deleted FB and it had zero impact on my life, for better or worse. I really question people who say it does. My guess is that they're repeating what other people say because it makes you sound forward thinking.
Yup thats what i do for both insta and Facebook
And also move to mbasic.facebook.com for even more blazing fastness!
You get to choose whether it gets to ‘slurp’ your address book or location. You can just say no.
They “made mistakes” in the past that bypassed those preferences.
was that part of the FTC's consent decree, concerning Facebook's deceptive privacy practices?
All I could find was apps that downloaded users’ address books without proper permission, which prompted Apple to add controls. Do you have links to these “mistakes”?
Can confirm. Uninstalled the app and its spyware friend, the messenger app, years ago. Feel like my phones spies just a little less on me every day, and saved about 750mb of space.

Pro Tip: if you need messenger on mobile, set your browser to "desktop site" to avoid facebooks insistence on installing its spyware pile of poo.

Mobile site was fine but messages, maybe the most important part, have been disabled and instead you're pushed you to download their app. I've been using FaceSlim [1] since messages stopped being available. It is actually a wrapper to the normal website but resembling the mobile site. Thus it is light, has messages and clean interface.

[1]: https://github.com/indywidualny/FaceSlim

(Only on Android though...)

Keep in mind that the size of the app listed on the App Store is not actually the size of the app on device. Apple automatically removes unneeded assets [0] from the bundles based on the device that's downloading it. I just downloaded Facebook on my iPhone X and the app size came out to 314.5mb [1].

[0]: "App thinning" https://developer.apple.com/library/archive/qa/qa1795/_index...

[1]: https://imgur.com/a/lTJhMbx

That's not a significant difference...
I would say so; it's more than a third smaller than the figure quoted in the OP's title.
It's well over half again larger than any other app on my device, even after "thinning". Yes, it's a big savings, but it's still ludicrously large. At that point, I think it meaningfully falls into the "distinction without a difference" bucket.
It's still the same order of magnitude, which is still way higher than is reasonable.
Tbh that is a significant decrease. Find me a compression algorithm that can compress already compressed binary data by 30% and I'll give you a million dollars (after I make a few million dollars myself).
Please, it’s a big drop in terms of percentage, but it’s absurdly large for what the app does.
Oh I completely agree it's bloated as fuck, but your statement that it's not a significant decrease is untrue.

Edit: sorry, just saw you're not the person I replied to.

No worries :) and yeah, i just don’t get it. I oversaw the development of a high ranking app for the last 6 years and it was a massive focus of ours to keep it small for as long as possible. We saw that conversion dropped as the app grew, we assume as the size grew it encouraged people to wait for wifi or their next months data before they would start the download.
Not so much for iOS as on Android, because Apple doesn't sell devices with nearly zero space; some people are constantly out of space -- you don't want to be listed high on sort current apps by size.
Our research indicated the issue was more around data transfer and access to wifi, less around storage.
Well, bloated af before, bloated af after... I guess you can argue about the definition of significant but at that point I think you’ve lost the argument by default.
> Find me a compression algorithm that can compress already compressed binary data by 30%

App thinning does not compress the app; it just pulls out stuff that doesn’t match the device the app is being installed on. And keep in mind that most application binaries are far from random data.

I know, I'm just using compression as an argument to show how significant 30%+ is.
Still way larger than reported Android `.apk`.
If you want to post something complaining about how fat the FB app is and perhaps solicit comments from people who know about it, you should do that. It's not much of a 'Ask HN', though, because it's Ask HN, not 'spit take FB'.
(comment deleted)
I’m sure part of it is A/B tests for tons of things. Doubled or tripled resources and code but any given user only sees one variety of them.
The size you see on the App Store isn’t necessarily what the size will be when you install it to a device either. For example, on my iPhone 8 Plus is 307.3MB.

https://imgur.com/a/VwkFvxg

Yes, due to app thinning. But 300 MB is still an insane size for an app like this.
The app does a lot, it’s huge, it even has a built in live game show.
It also has something like 18000 classes in it, many of which are not used. While it may do many things, most of the app is just bloat.
And this doesn't include Messenger does it? The last time I had the misfortune of installing the app, they forced me to install a separate app for that.

I figured I'd just use facebook.com on the browser, and I happily did until they removed chat from the mobile site.

Now I use mbasic.facebook.com, which is incidentally much better because there's no bloated JavaScript (afaik).

I'm sure they'll discontinue mbasic soon too; it'll be a shame because Messenger is all I use Facebook for.

For reference, messenger.com is a standalone FB Messenger web app that works great -- my use-case for FB is largely the same as yours.
How are you using messenger.com on mobile? I use it on the desktop, but on mobile, the website just links to the app.
Messenger Lite works pretty well on Android. I don't know whether it's available on iOS or not.
If you select the Share option, one of the options on the bottom bar is actually "Request Desktop Site".
They employ a bunch of coders who are really good at solving textbook CS problems and whiteboarding medium/hard leetcode style questions but lack the experience, interest, and in some cases ability to stretch beyond that into, say, proper systems or application development. There are far too many of these individuals who are able to "contribute" to the application code base more or less without the supervision of properly experienced and qualified engineers (there was some article, I think on Reddit, about how the app used to have thousands or tens of thousands of classes, re-wrote large bits of iOS core libraries, etc.).
This seems like an implausibly detailed level of knowledge of Facebook's workforce, especially if derived from something you maybe saw on Reddit that was about something else.
I think this is a totally baseless comment.

1. Have you worked at Facebook as an engineer before? Do you first hand know that most engineers working on FB iOS app lack the experience and interest?

2. Have you reverse engineered the FB app and verified that the app lacks signs of proper system or application development?

There could be a good enough reason as to why the app re-wrote core iOS libraries - most popularly performance and missing features. Also, tens of thousands of classes don't directly translate to increased binary size - its usually the dependencies of the code that results in such large binary sizes.

Overall, if Facebook wanted to optimize its app size to be less than 491MB, they would have.

Maybe its on their roadmap, maybe they decided most of their userbase have the ability to download 491MB and it isn't impacting the growth funnel, heck maybe some of the engineers actually wanted to work on optimizing the app size but it was shot down by management. Slamming engineers who work at Facebook and calling them inexperienced is just mean.

> Have you reverse engineered the FB app and verified that the app lacks signs of proper system or application development?

Have you? The size of the core Facebook application binaries disagree with your statement of “tens of thousands of classes don't directly translate to increased binary size - its usually the dependencies of the code that results in such large binary sizes”.

I've not reverse engineered the FB app. I also don't think I'm legally allowed to.

I'm simply "speculating" that a large number of reimplemented classes might not be the reason for the increased binary size from anecdotal experience of building similar app binaries for iOS.

FWIW, I think this comment gives a pretty good reason for why the binary size is large - https://news.ycombinator.com/item?id=17996161

It is contractually you aren't supposed to, due to terms & conditions.

Legally, if you are in the USA (or some other country surrounded by water) get on a boat, take it 5-10 miles out, and start (also when on a flight over an ocean would give you some coverage).

The comment you referred to (thank you) makes perfect sense.

I bet the overwhelming bulk of reversing work done on everything, including iOS app is not done on planes or boats. Quite a bit of it is done in the US, to boot.
> It is contractually you aren't supposed to, due to terms & conditions.

I have never signed a contract with Facebook. Does that mean I’m free to reverse engineer it?

I guess he means the T&C you agree to when downloading the app from apple and fb
Who cares what you're 'legally allowed' to do on your own computer.

I thought this was 'hacker' news not 'let us study the click through EULA and respect the terms and conditions entirely' news.

If you can't or won't reverse engineer a binary file, you're a share cropper not a computer owner.

This is an awful take and doesn't reflect the truth in any way whatsoever.

The real answer is that Facebook does A LOT. Especially the main app. Facebook also serves A LOT of different audiences in a lot of different regions.

Just consider that there is an entire YouTube worth of functionality inside of the main Facebook app. And that's just one vector of functionality that they offer.

This is the truth.

They're predominately right out of school and don't understand systems engineering. If single schizophrenic man can create a complete 64-bit real-time multitasking operating system that can be distributed completely in a 2MB distribution, one of the highest valued tech companies in the world can make a glorified version of their website fit in under 20MB.

Think how many lifetimes are wasted each day waiting for Facebook to load or update.

I just uninstalled it about a year ago because I was so disgusted with it. Now, I get ads begging me to come back.

Instead of complaining, how about you fetch the package and reverse engineer it so you can answer your own question.
You are the kind of guy that goes about writing writing a web server in assembly
This is not possible to do without a jailbroken device, which not everyone has.
You don't need to jailbreak in order to do that.
How do you remove FairPlay without a jailbroken device?
It probably is at least partially autogenerated, contains tons of legacy code, code for different markets, code for yet unreleased features, NSA tracking code...
I'd really like to give them the benefit of the doubt, but at this point it's sheer incompetence. It's been pointed out in the past, and it's still growing.
Because they write a lot of code. Because they experiment between a lot of experiences. Because there's a lot of legacy code.

Because it's not an important constraint to them.

And there's Facebook Lite app.
Unfortunately not available in US iOS app store, though. Wish they would provide it everywhere.
Unless it's a business concern (i.e. affecting one of the metrics the business is measuring and reporting), it's not on management's mind and therefore won't be prioritized as something worth improving or prevent from getting worse.

Is it affecting app installs? Is it leading to a reduction of usage? No -> Don't fix.

As an outsider, that would be my guess of how the app can grow to be so large, without knowing the reason why.

The app size hovered below 100MB for a log time, because that was Apple’s threshold for non-WiFi installs. Once they blew that budget it seems to have got out of hand.
I just checked the App Store, it appears to have breached the 500MB barrier now: https://imgur.com/a/9LOrq1K
For myself and friends and family, I maintain a Linux distro. It contains Chrome, LibreOffice, GIMP, Inkscape, Skype, not to mention a full OS and video drivers etc. And it's smaller than the iOS Facebook app.
I think this is due to the fact they refuse to use the underlying APIs for DNS, TCP, etc and reimplement all that functionality within the application.

I think they are worried about apple or android removing access/throttling FB as they do not control the underlying platform (apple controls the devide, google controls the OS, and FB is the most deployed app across either platform)

It seems silly. If platform X implements function A, and you're worried they might change how function A works, just wrap function A in an adapter class/interface. If they change it, you can then re-implement it the way you want.
Can you run a separate network stack on iOS? How would that make network requests without using private APIs or accessing hardware directly, both of which Apple forbids?
I would be much more interested in details of the tech they use to bring iOS apps to Windows. Messenger for example looks like a direct port.
They acquired a company a while back called Osmeta that basically reimplemented parts of iOS.
All dem tracking hacks... Need to be sure.
I don't know if iOS has the equivalents but I personally use the "lite" versions of fb and messenger. Tempted to remove fb at some point and just use the browser tbh.
Why does it matter? Modern smartphones have more than enough space.
Favebook’s app is so large that they load code in dynamically so they can stay under the 20 second startup time limit imposed by iOS. Do you not see a problem there? Just loading the app into RAM means that you’ve consumed a substantial portion of it.
Not really, a lot of phones are 8GB. Once you remove the OS and the pre-built apps that's about 5GB left. Just the FB app takes about 10% of that? That's not really acceptable.

And that's not just theoretical: I have 16GB and I'm always scraping for storage

> Not really, a lot of phones are 8GB

Not many these days; the last iPhone that shipped with this configuration was the 5c four years ago (I had one; 8 GB sucked).

16GB only nets you about 20 of bloatware balloons like the Facebook app.

That whole line of reasoning is just antisocial laziness. You pay for it so I don’t need to bother.

Unless it's a KPI you won't get an OKR to address it
I started at Facebook a month ago. Honestly, I was wondering the same thing as you: how does this app which seemingly is a couple of UITableViews contained in a UITabBarController end up taking so much space?

I've come to realize that Facebook is sort of a global operating system for communities. Your Windows installation includes all the pieces to connect to an Active Directory enterprise network, even if all you'll ever do is play games from Steam. Facebook is like that: there's so much stuff you'll never see when you only use it to follow a bunch of old college friends.

Should those things be downloaded as needed? Maybe. But it would have a negative impact on metrics: if "New Feature X for Latin American Teenagers" takes 30 seconds to start up, it's not going to take off. It's easier when everything is already there. Besides, the effort of rearchitecting a 491MB app would be crazy. Of course Facebook has major public initiatives like React Native which could eventually allow parts of the native apps to be dynamically downloaded more easily (I don't know anything about whether that's planned, just stating the obvious).

I don't know if this qualifies, but aren't there strict restrictions on bypassing the AppStore for updates? Would downloadable binary blobs (code logic, not assets) like this be allowed by Apple?
I think (not 100% sure, I don’t work actively on iOS apps anymore) that Apple’s current policy is to allow code downloads if they are executed on an OS-provided runtime. That means JavaScriptCore in practice, and React Native passes that bar.
Since June 2017, an app can also run the downloaded code on its own interpreter, and it can be any language, not just JavaScript.
Only if the app allows the user to view the code, if I remember correctly. It was to encourage programming / teaching apps on the ipad and the like.
Only for apps that let the user see/write the code. You can't download code that changes the app's functionality.

2.5.2 Apps should be self-contained in their bundles, and may not read or write data outside the designated container area, nor may they download, install, or execute code which introduces or changes features or functionality of the app, including other apps.

Educational apps designed to teach, develop, or allow students to test executable code may, in limited circumstances, download code provided that such code is not used for other purposes. Such apps must make the source code provided by the Application completely viewable and editable by the user.

https://developer.apple.com/app-store/review/guidelines/

React native apps are written in JavaScript & HTML, but they are compiled to native code. They have access to APIs that a browser wouldn’t, and can even link to native libraries.
> this app which seemingly is a couple of UITableViews contained in a UITabBarController

Is it even that? The Facebook app’s UI is sufficiently different than the standard system controls that it seems to me that they might be completely custom.

so you explained 4 megabytes, now explain the other 487
Are you saying after a month there, you’re sure it’s not just a bunch of unused legacy code that engineers are smart enough not to delete because they’re not really sure what it does and the original authors have cashed out and are kickin’ it counting their money? Especially all that Objective C they’ve been madly trying to pave over with Swift?
Well, there is also facebook lite.
Come on - 491Ms are 514'850'816 bytes => if you distantiate yourself from the SW and all its potential layers (and keep only the endresult in mind) then you have to admit that that "mass" is reaaaaaaaally huge. Pure logic must be max some KB/MBs, but the rest has to be garbage or UI-stuff, no? If not, then everybody would have to publish a 500MB-website, or?
That excuses like 256MB, tops.
What's curious to me, in the light of your explanation, is why the app size didn't slowly build to 500MB over time, but jumped from 200MB to 500MB within the span of weeks/months.

What could have added 300MB to the total so quickly?

The Facebook app includes a massive amount of functionality. Open up the hamburger menu and you’ll see a subset of what it does: feed, groups, profiles, video, marketplace, events, camera app, search, crisis response, etc. Each of these has a very deep level of functionality. Facebook are also very data driven, which means they’re probably testing multiple versions of most features at any given time.

Each of the products is implemented by their own team. I wouldn’t be surprised if there are literally thousands of engineers commuting changes to the iOS app on a regular basis. If you are on a small team you can make a lot of headway against bloat on your own. For an app like Facebook it would be incredibly difficult to understand the entire thing, let alone make much of a difference.

Technologies like React Native are supposed to address bloat. It’s much more efficient to ship incremental features in JS (can even be done over the network), but React Native doesn’t solve every use case, and Facebook has a lot of legacy code.

Facebook doesn’t NEED any of that. I wish I worked there so I could rip all of that shit out of there and cut the whole company down to its proper size.
May I add a follow-up question? Why is their Android app 'only' 70MB?

Are there fundamental differences between Android apks and iOS application bundles that cause these size differences? It seems to be a pattern that iOS apps are just bigger:

  - Facebook on Android is 70MB while on iOS it is 491MB
  - Twitter on Android is 74MB while on iOS it is 178MB.
  - Spotify on Android is 104MB while on iOS it is 164MB.
  - Dropbox on Android is 112MB while on iOS it is 228MB.
Swift bundles?
That was my guess also, Swift apps are much heavier.
Facebook is all Objective-C++, if I recall correctly.
Yes, Android has apk splitting ( https://developer.android.com/google/play/publishing/multipl...), which enables different packages for different devices. This means an mdpi arm6 device in India doesn't need to download and install a package with xxhdpi assets and arm7 code, leading to a smaller effective package for each user.

Also note that both platforms do delta updates but generally show the total size in the UI. So every update you aren't actually downloading that much over the wire.

Source: I used to manage the Android and iOS release engineering teams at Facebook

iOS has app thinning, which does essentially the same thing. However this only reduces the app size a bit, since most of the actual size comes from the app binary which is shared across devices.
App thinning is not the same and not nearly as effective.

Not to be rude, but you are literally talking to someone who was in charge of this, looked at the graphs daily, and made the call when we went over the OTA limit on iOS. When I say multiple-apks are a large reason for the discrepancy, you should give me the benefit of the doubt. It's not the only reason mind you.

If you disagree with that, it might be good to provide a bit more context than “shut up I know what I’m talking about”.

As far as I was aware, the comment you were responding to was broadly accurate, but now I don’t know and have no additional information.

This was the reason for my downvote as well. “No it isn’t” is not very much to go on and saagarjha’s post didn’t merit pulling rank.
In a pseudo-anonymous forum you must provide facts - not rely on credentials. The answer to your “Do you not realize who I am” post is No, we have no idea.
https://m.facebook.com/notes/facebook-engineering/update-on-...

Christan Legnitto, working at FB on release engineering, see his submission of this article in 2013.

Comments should stand on their own. Nobody learns anything with a “because I said so - just trust me” comment.
This a text book example of moving the goal posts, and I don't care to see it on HN. Android obviously allows more freedom to app developers than Apple, including the freedom to raid the cookie jar numerous ways.

Your original claim was that OP needed to substantiate their credentials; it was done (regardless of who).

HN Guidelines suggest we reply to the strongest argument being made and to give the benefit of the doubt, and that doesn't seem to be your approach.

Edit: I can't believe I'm defending FB or anyone that caused their increase in usage.

No, you misunderstand the whole point. Credentials don't matter in an anonymous setting. That's the whole point, people can converse on equal terms. The only "credentials" in common display is whether or not your account is new.

Its purposely designed that way to encourage conversation. Its not like at work where you may fear challenging someone at a higher level than you.

I am aware that app thinning is not as effective, but to my knowledge it does the same thing: strip out unneeded architectures from the binary and remove unused assets. I'm sure you have more to share, so I'm all ears on what the differences are.
> you are literally talking to someone who was in charge of this

Ouch. Hope this isn’t how you managed your teams.

Are you looking at the iOS size as listed in the app store? They don't show the 'thinned' size - the actual download size for your device can be much smaller. For Android, developers have to generate separate builds, which already have the final size.
I just checked: On my iOS phone the Facebook App (Version 189.0) is 315MB. Plus 111MB of stored local data.
No, it's actually 0 MB since I deleted that bloated ____.