5 ms·
Facebook had hundreds of millions daily active users before writing a compiler.
by rafark 3y ago
Facebook had hundreds of millions daily active users before writing a compiler.
- pjmlp 3y agoAnd lots of nodes not able to keep up, rewriting backend services in C++ to make up for it.
- coding123 3y ago98% of the people that initially thought (Python for Threads - OMG performance!) work at a company that will tell you straight up they expect 100M RPS in a year or two, will actually only get to 50k RPS in 5 years before the "Our incredible journey" letter is issued.
- di456 3y agoI use an unscientific rule of thumb that 10-100x scaling is about the most to plan for except for exceptional cases. Anything beyond that ends up with overcomplicated bloat for a "tomorrow" problem. Being able to handle spikes and iterate quickly is probably more important.
- rewmie 3y ago> 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.
- depereo 3y agoIf you have hundreds of millions of daily active users then needing to write a compiler isn't the end of the world.
- lyu07282 3y agoCompiling 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?
- georgyo 3y ago[flagged]
- dang 3y agoPlease 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 https://news.ycombinator.com/newsguidelines.html
- rewmie 3y ago> 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.
- georgyo 3y agoI 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.
- lyu07282 3y agoSuch 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) https://en.wikipedia.org/wiki/Hack_(programming_language)
- rewmie 3y ago> 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.