On Thu, Dec 20, 2012 at 7:18 PM, Arunoda Susiripala < [email protected]> wrote:
> Hi, some corrections :) > > JavaScript is aa intepreted 100%. > do you compile it before it getting runs? > > Yes it does compiling (optimisation on the v8) but that does not imply > JavaScript as a compiled language. > It's tempting to say that a language that's run through a JIT is still an interpreted language (especially given that JavaScript was originally interpreted), but in the case of many of the most popular JavaScript runtimes, whether they're static JIT compilers like V8 or tracing compilers like Nitro, that's simply not true. If you read Vyacheslav Egerov's excellent posts on the V8's internals (at http://mrale.ph/) and wingolog's posts on crankshaft and WebKitCore (http://wingolog.org/tags/javascript), you'll see that the end result of modern JavaScript compilers differs from older, unambiguously compiled JITted languages like Self and Java only in that JS compilers don't save their generated bytecode. Code that has been put through Crankshaft is machine code; the JavaScript is still kept around as an artifact, but what's running is a native representation, not a set of VM instructions being run by an interpreter. In fact, saving the compiled intermediate representation on disk a la Rubinius or javac would be a step *backwards*, because part of the point of Hydrogen and Lithium is that they're decorated with information about which code paths are being hit hardest in a given application, ensuring that the generated native code is chosen to be as close to optimal as possible for the current scenario. Ultimately the distinction between "compiled" and "interpreted" is becoming as vague as the distinction between "dynamic" and "static" type systems, but it's simply not true to say that modern JS runtimes are "100% interpreted". F -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
