Expert to Expert - Erik Meijer and Lars Bak: Inside V8 - A Javascript Virtual Machine
- Posted: Apr 29, 2009 at 9:29 AM
- 54,910 Views
- 19 Comments
Download
How do I download the videos?
- To download, right click the file type you would like and pick “Save target as…” or “Save link as…”
Why should I download videos from Channel9?
- It's an easy way to save the videos you like locally.
- You can save the videos in order to watch them offline.
- If all you want is to hear the audio, you can download the MP3!
Which version should I choose?
- If you want to view the video on your PC, Xbox or Media Center, download the High Quality WMV file (this is the highest quality version we have available).
- If you'd like a lower bitrate version, to reduce the download time or cost, then choose the Medium Quality WMV file.
- If you have a Zune, WP7, iPhone, iPad, or iPod device, choose the low or medium MP4 file.
- If you just want to hear the audio of the video, choose the MP3 file.
Right click “Save as…”
- High Quality WMV (PC, Xbox, MCE)
- MP3 (Audio only)
- MP4 (iPod, Zune HD)
- Mid Quality WMV (Lo-band, Mobile)
- WMV (WMV Video)
Lars Bak is a virtual machine master. He and team have created a Javascript VM, V8, that takes Javascript syntax and produces optimized machine code directly. The result is very performant execution of Javascript. How does V8 work, exactly? What are the
basic design decisions that have gone into it's construction? Why is it designed the way it is? How fast can Javascript really run, anyway? How challenging is it to take a language like Javascript and produce highly optimized machine code?
Erik Meijer, language designer and fundamentalist functional high priest, discusses these questions and more with Lars. We also talk about the language to machine code translation versus having an intermediate step (like IL) that gets optimized further in runtime context by a JITer.
If you want to know the thinking behind the thinking of Javascript compilation, the current state of the art and future directions, then this is for you. Big thanks to Lars Bak for spending time with Channel 9!
Enjoy!
Erik Meijer, language designer and fundamentalist functional high priest, discusses these questions and more with Lars. We also talk about the language to machine code translation versus having an intermediate step (like IL) that gets optimized further in runtime context by a JITer.
If you want to know the thinking behind the thinking of Javascript compilation, the current state of the art and future directions, then this is for you. Big thanks to Lars Bak for spending time with Channel 9!
Enjoy!
Comments Closed
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
Good to see the good ol javascript is still alive and kicking and to see people still developing and optimizing for it.
And Erik is as always excellent,.. nice shirt again Erik
You shouldnt mix all those colors in the washer
That is neat. Perhaps Microsoft will adopt V8 for their gadget engine in Windows or perhaps even IE?
Lars is an engineer's engineer. The work he has done is impressive and more than worthy of an appearance on C9's Expert to Expert regardless of the fact that he works for a competitor in the industry...
Perhaps you think Channel 9 is just Microsoft Marketing?
C
Go Obama....err Charles !
It's not change.
I like to believe Channel 9 has always been this way.
On the flip side, at one point Lars said why not compile F# to C#, instead of MSIL. I say you are then hampered by the semantics of C#. Quite a few functional languages compile to C and they all suffer from the tailcall problem and have to generate really unnatural C code (the well-known "trampoline" solution). One advantage of an IL is it can expose features that higher-level languages do not. C# has no concept of a "tailcall", but IL allows it.
Another argument is that an IL is really an "API ", just a weird one. Programs on either side of the API can change, but as long as the API and its behavior is stable, they can change independently. The same would be true if you generated C# but I would argue that is the kind of API I don't want to code to.
Anyways, great discussion as always!
p.s. Erik how can you say only Haskell compilers are written in pure Haskell? For shame!
it would have been really interesting to hear what lars thougt of the DLR and sort of what the differences are (some are obvious ofcourse but you know what i mean) maybe if google doesnt throw lars in a dungeon somewhere for talking about this stuff, you could invite him back and have an E2E with jim hugunin
conceptually this interview is really awsome. a guy from google is on a microsoft community site talking about the internals of one of chromes most touted features
slightly of topic, who shot this by the way? charles you where standing of the the side, yet the camera panned to you, so someone else had to be shooting.. or did eric movie it using only his mighty brainwaves?
C
C
Fun discourse. Debate is a great part of conversation - otherwise it's just an hour of bobbing heads and smiling faces. Boring...
C
if(point.class == Point){ // it's a point so the x component is the first in memory return point[0]; }else{ // use the slow path for other objects location = point.class.lookup("x"); return point[location]; }Is this how V8 does attribute lookup? Does V8 adapt this generated code at runtime? What happens with this code: Will this check the point class twice, or is V8 smart enough to check it only once?Other than that it was really interesting.
wow damn good and smart discusion. Even though I am a layman, the discusion on validating @ source code level sound+seem damn cool.
As a layman, I am wondering will V8 be optimized for other scripting language? If they do that will chrome be as huge as an OS? anyway maybe we do not even need a browser application anymore. Too bad there are many political issues to settle if that is to become a reality in the desktop world (hope the mobile world will be free of that ^^).
Erik and Charles are sharp and smart.
I also like Justin comments on IL being a weird API.
Keep up all the good work Channel 9 and all the computer science geek. Cheers.
============================================================================
(XML--> learn --> produce / transform New XML --> learn --> produce or transform New XML .... oh no!!!)
Towards the end of the talk, there was some discussion about the decision to compile JavaScript directly to machine code versus using an intermediate bytecode/language.
I think that one of the biggest differences in this case is the nature of how JavaScript itself is usually deployed and executed by clients. Being that V8 is targeted toward executing JavaScript that is usually already deployed somewhere on the web, it must expect that its input is JavaScript code. For better or for worse, JavaScript code is what is living out there on the web, and not some intermediate bytecode/language.
If there was more upfront control regarding the development and deployment of the code itself, it would probably make more sense to use some intermediate bytecode/language. I think that the big advantage to using an intermediate bytecode/language is not so much for the virtual machine, but really for the developer's experience while creating the code itself. It allows for easier/faster syntax checking, IDE features (code navigation, auto completion, etc), and to some extent can hide implementation details from an end user when it is deployed remotely.
Anyway, although this work is no doubt interesting, I can't help but wonder why we aren't pooling our efforts into generalizing more mature virtual machines (such as the JVM, etc.) instead of creating new and specialized ones like V8. The open nature of some VMs, such as the JVM, allow them to be slimmed down, generalized, and then tuned for different execution profiles (Java Server, Java Client, JavaScript, Python, etc), yet still take advantage of all the work that has already been devoted to these projects.
easily one of the most interesting chats i've seen for a long time - i love this level of conversation and would really like to see more of this kind of interaction between ms and google here or elsewhere.
ms _is_ doing very interesting research projects - google _is releasing_ very interesting research projects. i want the research arm of ms take more of a lead in actual production systems . it's abundantly clear that we would all benifit from ms sales keeping out of what makes it to production.
Remove this comment
Remove this thread
close