Sunday, November 22, 2015

Facebook and its Spaghetti Code

When I first got my Nexus 4 phone almost 3 years ago, I was very impressed by its speed. This was a massive upgrade from my HTC Glacier and I was really excited to get the full unhindered power of vanilla Android. Today, I'm still very impressed by the phone. Sure, it's showing its age (mostly the original battery, the accidentally shattered back, and the very displeasing Zagg cover), but the phone still runs decently fast. I'm surprised that Google supported it for this long. I'm pretty sure the last update we're getting is to Android 5.1.1.

I have noticed, however, that even the quad core processor can't seem to update Facebook without slowing the whole phone down very noticeably. It basically becomes unusable. This is really the only app I have this issue with, so I've concluded that it's probably the apps fault. I chalked it up to it being a very complex app with almost all of the features of the website (there are tons).


I wondered if this was affecting other aspects of my phone's performance, so I decided to try to use my phone without the Facebook app for a while and see if it made a noticeable difference. I never knew life without the Facebook app, so this would really be the first time without it. In order to get notifications on my phone when something happened on Facebook, I went to the mobile site and enabled Chrome notifications when it asked me. Within the hour I got a notification and they both came in at the exact same time. So I know that it's as real time as it gets (probably because they both use GCM).

I set out to get some baseline numbers. This had to be more than just qualitative to prove that the app of a social network giant was complete garbage. So that's exactly what I did. I used AnTuTu Benchmark to get the numbers both before and after Facebook's (and Messenger's) uninstallation. I also timed the time it took to shutdown the phone as well as boot up. Here are the results:


Test NameScore With FacebookScore Without Facebook
Shutdown Time*15.62 seconds16.01 seconds
Bootup Time**220.53 seconds78.89 seconds
Multitask36763091
Runtime22372116
CPU Integer21822146
CPU float-point20282028
Single-thread Integer16581675
Single-thread float-point10731082
Ram Operation11861201
Ram Speed11591162
2D Graphics16411637
3D Graphics (1280x768)76407888
Storage I/O395408
Database I/O315450
*Shutdown Time was measured from when the "Power Off" option was touched to when the screen tuned off.
**Bootup Time was measured from when the "Google" was seen to when the lock screen was shown.

After using it for a couple of days, I can report that my phone is snappier. Facebook clearly isn't using too many resources in the background, otherwise the benchmarks would be slightly slower. There are two categories that saw major improvements: Bootup Time and Database I/O. I imagine Facebook absolutely clutters the database with stuff and doesn't clean it up very well. Start up time is still over a minute, but at least this time it isn't over three minutes.

Over all, while the improvement wasn't as significant as I thought it would be, there is an improvement nonetheless. There was more of an improvement than there should have been after uninstalling two apps. All in all, it's beneficial (for me with a three year old phone, at least), to just use the mobile web app version of Facebook. Try it, it may speed your phone up too.

No comments:

Post a Comment