7 ms·
This was mentioned in that anonymous Facebook employee interview: http://news.ycombinator.com/item?id=1089800 http://news.ycombinator.com/item?id=1089800 Spec
by matthew-wegner 17y ago
This was mentioned in that anonymous Facebook employee interview: http://news.ycombinator.com/item?id=1089800 http://news.ycombinator.com/item?id=1089800
Specifically:
Rumpus: So tell me about the engineers.
Employee: They’re weird, and smart as balls. For example, this guy right now is single-handedly rewriting, essentially, the entire site. Our site is coded, I’d say, 90% in PHP. All the front end — everything you see — is generated via a language called PHP. He is creating HPHP, Hyper-PHP, which means he’s literally rewriting the entire language. There’s this distinction in coding between a scripted language and a compiled language. PHP is an example of a scripted language. The computer or browser reads the program like a script, from top to bottom, and executes it in that order: anything you declare at the bottom cannot be referenced at the top. But with a compiled language, the program you write is compiled into an executable file. It doesn’t have to read the program from beginning to end in order to execute commands. It’s much faster that way. So this engineer is converting the site from one that runs on a scripted language to one that runs on a compiled language. However, if you went to go talk to him about basketball, you would probably have the most awkward conversation you’d have with a human being in your entire life. You just can’t talk to these people on a normal level. If you wanted to talk about basketball, talk about graph theory. Then he’d get it. And there’s a lot of people like that. But by golly, they can do their jobs.
- jrockway 17y agoThe computer or browser reads the program like a script, from top to bottom, and executes it in that order: anything you declare at the bottom cannot be referenced at the top. But with a compiled language, the program you write is compiled into an executable file. It doesn’t have to read the program from beginning to end in order to execute commands. It’s much faster that way. I lost count of the number of untrue statements there after about ten.
- olalonde 17y agoWanna talk basketball?
- VonGuard 17y agoTerrified stare
- ubernostrum 17y agoSure. Just got back from watching KU/K-State. Great game; K-State played some strong defense down to the end of regulation, and KU had problems with poor shot choice the whole game. Thought for a minute KU was going to blow it again in overtime, especially after Collins missed the free throw, but that last foul on Brady (and the resulting five-point lead) was just the nail in the coffin. I do wish they hadn't had so many timekeeping problems, though (and I'm not sure what was up with the aggressive travelling calls in the first half either).
- profquail 17y agoNot without some graph theory: http://www.colleyrankings.com/method.html http://www.colleyrankings.com/method.html
- pbiggar 17y agoObviously, this isn't the traditional way of looking at compilation, but it does make sense. I guess the problem being described, somewhat obtusely, is that massive amounts of dependencies (in Facebook's case million of lines of code) are loaded in order to execute a relatively small page. I'll admit that to a CS person who understand compilers, their description makes it look like they don know what they're talking about. But if you explained Facebook's interpretation/compilation problems to a non-techy, it would probably come out sounding similar. (Note comment reuse: http://www.reddit.com/r/programming/comments/aodzg/one_facebook_employee_is_attempting_to_rewrite/c0ilx2j http://www.reddit.com/r/programming/comments/aodzg/one_faceb...)
- jrockway 17y agoIt's the wrong distinction to make. PHP is slow because the runtime is slow, not because it's a "scripting language". SBCL and V8 and TraceMonkey are all very fast "scripting languages" because they have a good codegen in the runtime. PHP does not do any codegen. If I were explaining this to a non-technical person, I would say: A computer works by executing instructions, one at a time. When PHP is executed, it is compiled to a list of instructions, but not ones the processor can directly understand. It uses a "virtual machine" to read each instruction and then execute the corresponding instructions on the real computer. This is slow, because what could be one instruction actually becomes many, sometimes hundreds, of actual instructions. The goal of this project is to skip the virtual machine and run our code directly on the real machine, meaning that we won't have to do as much unnecessary work. This will make our application run faster! Now, this still might make CS folks mad, because there is bookkeeping overhead other than deciding which instructions to run (you can't store "scalars" in registers, after all), and of course modern CPUs don't execute one instruction at a time. But now we're wandering off into esoterica -- at least the basic idea is right, and I don't use meaningless expressions like "scripting language".
- pbiggar 17y agoYes, the runtime is slow. But many language design decision, notably references, make it difficult to make a fast implementation (I should know, I did my PhD on it). They're trying to explain the problems that Facebook are having, which is that there is just such a large volume of code. They aren't trying to give a short course in interpretation and compilation. Scripting language is not a meaningless expression. Many papers use it. I submitted papers with "scripting language" in the title to PLDI and POPL, and there was not one complaint or problem with the term from reviewers (who found plenty of tiny "errors" otherwise).
- pbiggar 17y agoHmmmm. There's no way you can name ten. I'd wager you can't name five, and I'd be surprised if you could name two.
- jmillikin 17y agoI can name at least nine; assuming jrockway is more familiar with PHP than I am (very likely), 10 is reasonable or even understated. 1) The term "scripting language"; meaningless, and usually just used as an insult (as in this case) rather than with any reasonable definition. 2) Browsers don't execute PHP 3) Not all scripting languages are executed based on line order. 4) PHP doesn't require values to be declared before they're used. 5) Not all compiled languages are compiled to a separate file. 6) Most modern compiled languages compile to byte-code, which is not more "executable" than the original source. 7) Compilers do have to read the program from beginning to end. This might just be my ignorance, but I've never heard of a random-access parser. 8) Being compiled doesn't necessarily make execution any faster. 9) The compiled file still has to be read entirely, before it can be executed. Depending on code size, sections of it may be read repeatedly.
- olalonde 17y agoYou'd have to work pretty hard to make a compiled algorithm slower than an interpreted one.
- gaius 17y agoNot true. The runtime has access to information that the compiler doesn't, such as which branches are actually taken.
- pbiggar 17y agoThis makes no sense. Interpreters add indirection at every single statement in the program. The fact that they may know the direction of the occasional branch cannot possibly make up for this.
- sounddust 17y agoThe person being interviewed was obviously a non-technical person who was trying to provide information as he/she understood. It's easy to just take every statement literally and proclaim the person an idiot, but it's almost as easy to translate these statements into their (obvious) accurate equivalents and get some value from this interview. I don't understand the point of the former approach.
- brown9-2 17y agoTo expand, the interviewer in the original interview: - thought that Facebook's servers would be hosted in their office - was unfamiliar with the idea of usability studies or tracking eyeballs during usability studies - was baffled by the idea that facebook would track your clicks throughout the entire site to help determine who your closest contacts were - was also surprised by the fact that in the cloud, nothing is ever truly deleted - was surprised to see that facebook employees would have the ability to login as any user in the system
- w1ntermute 17y agoYour link is for this story, not for the quote. Here's the correct source: http://therumpus.net/2010/01/conversations-about-the-internet-5-anonymous-facebook-employee/?full=yes http://therumpus.net/2010/01/conversations-about-the-interne...
- quickpost 17y agoThanks! I kept clicking the above link and ending up right back in the same place! Time for a break.
- carson 17y agoIf this is true and it is just a compiled version of PHP how much better is that going to be than APC or eAccelerator? There must be more to it than just compiled PHP.
- wvenable 17y agoThe idea is probably to compile PHP into machine code rather than byte code.
- bad_user 17y agoI know you're thinking machine code must be better than byte-code, but that doesn't do any good, quite the opposite. With byte-code you can compile sections of code to machine-code, based on runtime profiling / type-inference (as the JVM does). With ahead-of-time compiling to machine code, you're probably going to end up with a serialization of the PHP code in the final executable, plus an interpreter :)
- tlrobinson 17y ago[cringe] This person knows just enough to be dangerous.