News for hackers. Stuff that matters.
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by butz on Monday March 02, 2020 @03:44PM (#22468739)
The loop of app building: 1. Build app with native framework. 2. Re-build app with some alternative framework which is slower, but let's you deploy single code on all platforms. 3. Re-build app with native framework, because it is faster. 4. GOTO 2
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by nneonneo on Monday March 02, 2020 @06:22PM (#22470178)
The best part about this cycle is that developers can always point to some metric which shows improvement to justify their actions, resulting in an Escher-like loop where they think they’re always going up.

These cycles pop up all the time in development as priorities shift (or as developers find more excuses to “fix” what isn’t broken). Real world coding always involves compromise - leadership is recognizing which compromises to make without continually backpedaling.

Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by lord_braleigh on Monday March 02, 2020 @08:13PM (#22470915)
To be fair, small fast messenger 2020 is "better" (aka more features / millisecond of cold start) than small fast messenger 2016. The cycle doesn't always go up monotonically, even if developers pretend it does. But it is possible to go "full-circle" through the loop and wind up in a better place than you started, and it's even possible for each stage of the loop to be truly justified given product needs.
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by joshspankit on Monday March 02, 2020 @09:06PM (#22471204)
How much of that is simply improvement in processing speed of the device and/or better OS APIs?
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by ferzul on Tuesday March 03, 2020 @03:36AM (#22472854)
indeed, it could be rational business needs. at a time when it's more expensive to hire devs, maybe it looks better to have a single codebase. at a time when performance is more valued, maybe it's better to rewrite in native.
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by blunte on Tuesday March 03, 2020 @04:15AM (#22473003)
I don't know what world you live in, but in my world developers don't have to look for excuses to do work. Perhaps some companies running on endless VC overhire, but the real working world has fewer employees for most positions than it needs.

And in the case of Messenger, I highly doubt it was the developers who said, "Hey, let's add this completely unrelated thing to our codebase - payments!". More likely it was marketing or "product" that told the devs what to add.

Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by woadwarrior01 on Tuesday March 03, 2020 @02:04AM (#22472434)
That's the problem with Coordinate descent[1], which is how we humans intuitively go about optimizing things.

[1]: https://en.wikipedia.org/wiki/Coordinate_descent

Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by fao_ on Monday March 02, 2020 @09:45PM (#22471351)
From TFA: "We reduced core Messenger code by 84 percent, from more than 1.7M lines to 360,000."

Sounds like not only did they make the app quicker and lighter, they improved code maintenance too. If the android app is as the same size as the new ios messenger app, they'd still have less code to maintain than the previous ios messenger app.

See also: this other comment - https://news.ycombinator.com/item?id=22468036

Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by hvidgaard on Tuesday March 03, 2020 @01:51AM (#22472381)
How in the name of everything did they manage to write 1.7M lines of code for a messenger app? That is an astonishingly large code base! We're talking about an instant messenger app with heaps of features, having a LoC footprint 3.5% of the size of modern Windows.
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by tasogare on Tuesday March 03, 2020 @03:40AM (#22472882)
> Since then, we’ve added payments, camera effects, Stories, GIFs, and even video chat capabilities

Simple: they added tons of crap nobody care. On this list, I only use video. Messenger is valuable because of the network effect, but feature wise 2003’s MSN was good enough.

Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by SifJar on Tuesday March 03, 2020 @07:31AM (#22473887)
> nobody care

> _I_ only use

(emphasis added)

Just because you don't use those features, doesn't mean nobody cares about them

Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by hvidgaard on Tuesday March 03, 2020 @03:54AM (#22472933)
None of that justifies 1.7 million LoC.
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by Ayc0 on Tuesday March 03, 2020 @08:59AM (#22474441)
That's not true, the application, whether you like or not, it full of micro-interactions, well-done animations and transitions, features like the payment or stories, you can take photos directly from the app, etc.

With that many features, it doesn't surprise me that the previous codebase was 1.7M LoC. Sure if you count only the messaging part, I'm fairly certain that the LoC is way lower than this.

It doesn't make sense to compare the number of LoC of messenger to the number of LoC of software like Postgres because Postgres tries to be good at 1 thing and messenger tries to have a ton of features with good UI and UX.

I don't like many of their features (I'm not using the stories or the payment), but some of my friends do and you have to recognize the work that the messenger team did to make them work that well.

Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by throwaway55554 on Tuesday March 10, 2020 @04:30PM (#22539353)
Don't forget all the code to support A/B testing.
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by Gene_Parmesan on Tuesday March 03, 2020 @03:05PM (#22478256)
One of their points in the article was how they've decided to use more of the native OS interfaces instead of implementing their own versions (!!). For instance, using the OS's native threading library instead of writing their own. So, the number of LoC kinda start to make sense when you think about them re-implementing some not-trivial chunk of an OS's native functionality.
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by ashishb on Tuesday March 03, 2020 @06:55AM (#22473651)
LOC is proportional to the number of engineers on a project. All engineers have to justify their existence, so, they will write code.
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by therealdrag0 on Tuesday March 03, 2020 @11:29AM (#22475944)
I've never felt the need to justify my own existence. There's always been a longer backlog of work than my teams would ever get through and managers who appreciated the work getting done.

Another plausible explanation is lack of code re-use and reinventing the wheel because you don't know someone else solved the same problem. Also correlates with number of engineers.

Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by philips4350 on Tuesday March 03, 2020 @02:23AM (#22472521)
I wonder if react native library code and all the other code related to it like the js engine is included in that metrics.
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by danabramov on Tuesday March 03, 2020 @05:10AM (#22473214)
There was no React Native in the Messenger app before the rewrite.
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by philips4350 on Tuesday March 03, 2020 @06:57AM (#22473667)
Oh my bad, i thought all facebook apps used react native
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by FunnyLookinHat on Tuesday March 03, 2020 @09:17AM (#22474583)
I had the same question... And that's not counting LOC on the server. And all of this is for... glorified text messaging, right? I don't use FB so I could be missing context or features.
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by azinman2 on Tuesday March 03, 2020 @02:22AM (#22472507)
And they ended up in hundreds of thousands of lines :)

Wonder if part of this is custom video / audio codecs? That I’d imagine would contribute a good amount...

Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by toastal on Monday March 02, 2020 @11:50PM (#22471873)
I wonder how this will effect Lite. I use it over Messenger strictly to reduce bloat and get an app with the bare essentials of chat and calls fol friends that refuse to use Signal.
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by flucivja on Tuesday March 03, 2020 @10:59AM (#22475575)
I'am curious if in 360K LOC are also included templates configurations stored in SQLite because these must be written and maintained too.
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by notJim on Monday March 02, 2020 @06:50PM (#22470394)
It's great, because each approach has pros and cons, so as long as you primarily focus on the pros, it's a win every time.
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by dzonga on Monday March 02, 2020 @06:40PM (#22470324)
the reason is they're high paid engineers without skin in the game. Fb is already making money, hence a lot of engineering efforts are not related to having fb make money, but to prove the engineer's worth.
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by mathgladiator on Monday March 02, 2020 @07:18PM (#22470583)
And to keep people in the game to operationally care.
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by robofanatic on Monday March 02, 2020 @04:42PM (#22469367)
Mainframe -> Native Desktop apps -> Web apps -> Native Mobile Apps -> Mobile Web apps
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by thedance on Monday March 02, 2020 @07:32PM (#22470646)
More like: make app hideous and bloated; make app slightly smaller; crow about your harvest of low-hanging fruit
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by keyle on Monday March 02, 2020 @05:19PM (#22469661)
1. Developers: YEP! 2. Developers: YEP! 3. Developers: YEP!

Munch Munch Code Munch WTF Munch AGILE! $$$ Munch.

Designers: 1. We need a new design system. 2. We need a new brand! 3. We need a new font!

Users: ¯\_(ツ)_/¯

/s <3

Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by Illniyar on Tuesday March 03, 2020 @12:31AM (#22472071)
As far as I know messenger was never written in a cross-platform way, neither RN or otherwise.

Is there anywhere that suggets it was ever non native?

Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by danabramov on Tuesday March 03, 2020 @05:10AM (#22473216)
It was fully native.
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by vijaybritto on Tuesday March 03, 2020 @06:32AM (#22473562)
Not sure why people are downvoting an insider answer from an actual FB employee
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by avocade on Tuesday March 03, 2020 @06:33AM (#22473564)
Exactly. But this was the last time the business collectively did something that short-sighted, right? Last time.
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by ngcc_hk on Monday March 02, 2020 @10:56PM (#22471663)
Better than plan plan plan. It is the customer or user that use it that count. Not the programmer.
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by BubRoss on Monday March 02, 2020 @09:22PM (#22471278)
You do realize that you can have one code base and write in C++ right? You don't need a slow framework to have a UI run in multiple places.
Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by pjmlp on Tuesday March 03, 2020 @07:21AM (#22473822)
Somehow younger generations are allergic to it, you seldom see it listed as alternative for portable busines code, even though it is available out of the box in all mobile SDKs, with first class IDE support alongside the respective upper layer languages on the platforms.

And the amount of time spend writing a bit of glue code, specially on Android, is still less than debugging integration issues in all those Hybrid/Abstration frameworks.

Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by ksec on Tuesday March 03, 2020 @10:59AM (#22475581)
>Somehow younger generations are allergic to it,

Because they haven't been burned by that cycle yet.

Re:LightSpeed: Rewriting Messenger’s codebase for a faster, ... by tomaszs on Monday March 02, 2020 @04:17PM (#22469102)
Perfect :)