News for hackers. Stuff that matters.
Re:Back end of Meta Threads is built with Python 3.10 with s... by rewmie on Thursday July 06, 2023 @05:26PM (#36623304)
> Facebook had hundreds of millions daily active users before writing a compiler.

In other words, Facebook felt compelled to write a compiler when they had hundreds of millions daily active users.

Re:Back end of Meta Threads is built with Python 3.10 with s... by depereo on Thursday July 06, 2023 @05:39PM (#36623465)
If you have hundreds of millions of daily active users then needing to write a compiler isn't the end of the world.
Re:Back end of Meta Threads is built with Python 3.10 with s... by lyu07282 on Thursday July 06, 2023 @10:03PM (#36626068)
Compiling PHP into machine code sounds pretty much impossible, are they using some subset of the language? Does the compiled code use a garbage collector? Or reference counting?
Re:Back end of Meta Threads is built with Python 3.10 with s... by georgyo on Thursday July 06, 2023 @10:42PM (#36626400)
This may be shocking to you, but _all_ code is effectively compiled to "machine code" eventually.

If it is running on your CPU, then it is running on your machine.

When the compilation happens can be different (interpretted, JIT, ahead of time) but those are just design choices.

Re:Back end of Meta Threads is built with Python 3.10 with s... by rewmie on Friday July 07, 2023 @01:01AM (#36627374)
> This may be shocking to you, but _all_ code is effectively compiled to "machine code" eventually.

I'm not sure you understood the point. It means nothing to claim that deep down it's all opcodes or electrons flowing. What matters is being able to transform the code targeting the high level interface to the lowest level interface in a way that remains usable and regression-free. Sometimes compilers for widely popular languages introduce bugs and weird behavior too.

Re:Back end of Meta Threads is built with Python 3.10 with s... by georgyo on Friday July 07, 2023 @09:08AM (#36631161)
I don't think you understood the comments above, but I definitely don't understand your point...

Compilers introduce bugs, yes. Compilers are code, and code can have bugs and regressions.

But the comments above make no mention of bugs are regressions. They said compiling php into machine code is "impossible."

Going form high level interfaces to lower level is the easy part. It's what all interprets and compilers do already.

Having different intermediate forms is also a very common practice. There is nothing special about php here. Except for maybe it's underserved reputation of being an obtuse language.

Re:Back end of Meta Threads is built with Python 3.10 with s... by lyu07282 on Friday July 07, 2023 @09:31AM (#36631483)
Such a pedantic response, the archetypical HN comment, I can sense the pretentious smirk on your face while writing it, thanks. Words still mean something, we don't compile a dynamically typed, interpreted scripting language such as PHP for a reason and as it turns out Facebook didn't "compile PHP" either but a dialect of the language.

https://en.wikipedia.org/wiki/Hack_(programming_language)

Re:Back end of Meta Threads is built with Python 3.10 with s... by redsky880 on Friday July 07, 2023 @06:19PM (#36639030)
Facebook transpiled it before using the HHVM.

https://en.wikipedia.org/wiki/HipHop_for_PHP

Re:Back end of Meta Threads is built with Python 3.10 with s... by dang on Sunday July 09, 2023 @02:06PM (#36657097)
Please don't respond to a bad comment by breaking the site guidelines yourself. That only makes things worse.

https://news.ycombinator.com/newsguidelines.html

Re:Back end of Meta Threads is built with Python 3.10 with s... by dang on Sunday July 09, 2023 @02:06PM (#36657095)
Please follow the site guidelines and edit swipes and putdowns out of your comments here. They're not what this site is for, and destroy what it is for.

https://news.ycombinator.com/newsguidelines.html

Re:Back end of Meta Threads is built with Python 3.10 with s... by jgwil2 on Thursday July 06, 2023 @11:06PM (#36626565)
> are they using some subset of the language?

They're using a derived language called Hack.

> Does the compiled code use a garbage collector? Or reference counting?

Not sure but it's open source so I'm sure you can dig up the answers one way or another: https://github.com/facebook/hhvm

Re:Back end of Meta Threads is built with Python 3.10 with s... by rewmie on Friday July 07, 2023 @12:57AM (#36627345)
> If you have hundreds of millions of daily active users then needing to write a compiler isn't the end of the world.

It's not the end of the world because they have deep pockets and a problem domain where preserving the interface (I.e., keep everything still running on PHP) and optimizing the infrastructure that provides it is more cost effective and least disruptive than switching to a tech stack that is more performant.