5 ms·
Obviously, 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 ma
by pbiggar 17y ago
Obviously, 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).
- jrockway 17y agoWhat does "scripting language" generally mean. UNIX "scripts" can be written in C. Is C a scripting language?
- lolcraft 17y agoFrom my understanding of the issue, a scripting language was once a small language with one purpose which quickly expanded to fill all possible needs (e.g. Perl). By this definition C isn't a scripting language, as it was small and stood that way.
- jrockway 17y agoHow is that meaningful from a computer science standpoint?
- SapphireSun 17y agoI'm definitely stealing from someone else's comment a long time ago but they said it very well: The difference is that scripting languages have no main function (as far as I know).
- Hexstream 17y agoWell, isn't that called a "general-purpose programming language"?
- SapphireSun 17y agoMaybe "scripting language" is the way today's kids say it?
- Hexstream 17y agoC is a general-purpose programming language but I don't think anyone ever called it a "scripting" language... (besides "scripting" DSL's with C syntax in some games)
- dangrossman 17y agoIt's the description of PHP that isn't quite right. It's not read perfectly top-down like a script, nor is it interpreted at the same time as it's read. You can declare a function at the end of a file and use it in the first line.
- pbiggar 17y agoWell, that's not quite right either. I've purged my mind of the edge cases here, but it generally involves includes. I admit it sounds a bit off, like the quotee doesn't know exactly what she's talking about, but she's not egregiously wrong.