News for hackers. Stuff that matters.
Re:Facebook rewrites PHP runtime, will open source on Tuesday by jrockway on Saturday January 30, 2010 @11:53PM (#1090022)
It'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".

Re:Facebook rewrites PHP runtime, will open source on Tuesday by pbiggar on Sunday January 31, 2010 @05:12AM (#1090346)
Yes, 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).

Re:Facebook rewrites PHP runtime, will open source on Tuesday by jrockway on Sunday January 31, 2010 @06:08AM (#1090375)
What does "scripting language" generally mean. UNIX "scripts" can be written in C. Is C a scripting language?
Re:Facebook rewrites PHP runtime, will open source on Tuesday by pbiggar on Sunday January 31, 2010 @04:45PM (#1091156)
Generally speaking, a scripting language comes from the set {Python, Perl, JavaScript, PHP, Lua, Ruby}.

Its a tricky term to define, much like "compiler". Actually "compiler" is a nice analogy: everyone knows what one is, but the actual test for "is this a compiler" is shaky, and returns true for lots of things that aren't _really_ compilers.

Anyway, Ousterout coined it in his paper on TCL, but annoyingly chose not to formally define it. The set at that time was (I think) {TCL, Perl, sh}.

But because he didn't define it properly, the word has been used for years without a proper definition. The best I can do is to say read my PhD thesis, starting on page 7, where I'd spent a meaty six pages explaining in as much detail as I can what it means to be a scripting language.

Re:Facebook rewrites PHP runtime, will open source on Tuesday by lolcraft on Sunday January 31, 2010 @07:29AM (#1090417)
From 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.

Re:Facebook rewrites PHP runtime, will open source on Tuesday by jrockway on Sunday January 31, 2010 @08:30AM (#1090448)
How is that meaningful from a computer science standpoint?
Re:Facebook rewrites PHP runtime, will open source on Tuesday by SapphireSun on Sunday January 31, 2010 @01:48PM (#1090838)
I'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).
Re:Facebook rewrites PHP runtime, will open source on Tuesday by lanstein on Monday February 01, 2010 @01:42AM (#1091931)
This obviously is not in the spirit of what you're saying, but...

Python main() functions by Guido van Rossum

http://www.artima.com/weblogs/viewpost.jsp?thread=4829

Re:Facebook rewrites PHP runtime, will open source on Tuesday by SapphireSun on Monday February 01, 2010 @09:08PM (#1094076)
I think the idea is that you optionally can have a main, but you aren't required to do so ;-)
Re:Facebook rewrites PHP runtime, will open source on Tuesday by Hexstream on Sunday January 31, 2010 @05:07PM (#1091194)
Well, isn't that called a "general-purpose programming language"?
Re:Facebook rewrites PHP runtime, will open source on Tuesday by SapphireSun on Sunday January 31, 2010 @05:41PM (#1091253)
Maybe "scripting language" is the way today's kids say it?
Re:Facebook rewrites PHP runtime, will open source on Tuesday by Hexstream on Monday February 01, 2010 @04:14PM (#1093485)
C 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)
Re:Facebook rewrites PHP runtime, will open source on Tuesday by a0002 on Sunday January 31, 2010 @05:15PM (#1091210)
Quick question from a noob: why do references make it harder to make a fast implementation? I'm genuinely interested in the topic, could you post a link to your PhD thesis or some other relevant information? Cheers
Re:Facebook rewrites PHP runtime, will open source on Tuesday by romland on Sunday January 31, 2010 @08:38PM (#1091531)
I am guessing it is related to dereferencing. It seems Google agrees, it's also mentioned on Wikipedia at http://en.wikipedia.org/wiki/Reference_%28C%2B%2B%29#Relatio...

[snip]...consequence of this is that in many implementations, operating on a variable with automatic or static lifetime through a reference, although syntactically similar to accessing it directly, can involve hidden dereference operations that are costly.[/snip]