Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Expert to Expert - Erik Meijer and Lars Bak: Inside V8 - A Javascript Virtual Machine

Download

Right click “Save as…”

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!

Tags:

Follow the Discussion

  • Maddus MattusMaddus Mattus Maddus on C9, Is often ​controversi​al, But fun ​none-the-​less -​evildictait​or
    Nice!

    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 Wink

    You shouldnt mix all those colors in the washer Wink
  • It's nice to see a video on here that looks at a non-Microsoft technology up close like this.  This kind of content definitely keeps me watching.
  • I have NOT watched the movie clip yet.
    However, V8 was developed by Google and we are seeing a video of it on Microsoft.

    Can someone who watched this tell me if it looks like Microsoft will integrate it into IE in the future?
  • That is neat. Perhaps Microsoft will adopt V8 for their gadget engine in Windows or perhaps even IE?

  • CharlesCharles Welcome Change
    This isn't about Microsoft or Google or IE or Chrome... This is about building a virtual machine for a highly dynamic (and somewhat strange) scripting language that involves compilation of Javascript source code to machine code. Making assumptions about what this means from a business perspective is meaningless in this context. This about technology (V8) and an interesting general problem (dynamic script source to machine instruction translation).

    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? Smiley

    C
  • Welcome Change
    Perhaps you think Channel 9 is just Microsoft Marketing?
    Now that is the Change We Can Believe In.

    Go Obama....err Charles !
  • Maddus MattusMaddus Mattus Maddus on C9, Is often ​controversi​al, But fun ​none-the-​less -​evildictait​or

    It's not change.

    I like to believe Channel 9 has always been this way.

  • The discussion at the end about the irrelevance of intermediate languages was interesting. I've been dabbling in this area recently and intermediate languages seem to help make compiler/interpreter implementation simpler, but they can lack details you'd like to have in order to produce faster/smaller/safer code.

    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!
  • Allan LindqvistaL_ Kinect ftw
    great stuff Smiley the "to have IL or not have IL" discussion was very interesting. i always thougt the main reason for having IL was to enable multiple languages. otherwise every language would have to write a compiler/debugger for every platform, and that would be a pain.. but in the case of V8, there is only one language so thats not as great a problem.

    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 Smiley (eric, lars, jim, charles and 5 hours of dv hd space Wink )

    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 Smiley there has never been a clearer manifestation of the spirit of channel9 imo. screw the buisness, screw the lawyers, screw the marketing, this is about the science, the knowledge, the ideas and the sharing there of among peers. truly great stuff

    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? Smiley (although erics mind should be functional in nature so it should really return a new camera with the right angle rather than mutating the state of the exsisting one)
  • Excellent video!  I enjoyed Lars' talk on the lang.net symposium site and recommend it highly to any of you out there who enjoyed this E2E video:  http://www.langnetsymposium.com/2009/talks/18-LarsBak-JavaScript.html
  • CharlesCharles Welcome Change
    We have never been a marketing site.... That was my point. We often have folks whose minds house other ways of thinking from our own front and center on Channel 9. Otherwise, it gets boring!

    C
  • CharlesCharles Welcome Change
    Amen, brother.
    C
  • CharlesCharles Welcome Change
    The discussion about to IL or not to IL continued for at least an hour after the we stopped recording. It's a great discussion topic for sure. In my mind, IL is useful for the purposes of automatic reasoning, debugging and providing a fertile ground for language designers to concentrate on their language and not the conversion at some point to machine instructions (let the JITer take care of that rocket science). Going from syntax(C#) to syntax (MSIL) is easy. How would you readily inspect x86, for example, to ensure that the blob of instructions express type safety?

    Fun discourse. Debate is a great part of conversation - otherwise it's just an hour of bobbing heads and smiling faces. Boring... Smiley

    C
  • Excellent interview. I don't understand how the classes work. In the video it's explained that objects aren't stored as hash maps from strings to values, but in a compact representation. For the point class the x and y attributes will be stored sequentially in memory (like in C#). My question is, how does attribute lookup work? If I do point.x, how does it know where to find x in memory? Does V8 look up the string "x" in the point class and finds that x is the first (or second) cell in memory? That would be no faster than hash maps (but it will save memory). I suppose that V8 compiles some class checks like:
    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:
    foo = point.x
    bar = point.y
    Will this check the point class twice, or is V8 smart enough to check it only once?
  • stevo_stevo_ Human after all
    I completely don't agree with the points about validation, either way both validate.. I think the MSIL points we're duff, MSIL structure itself is well defined and designed for machines, its validation is far less complicated.. more so- the point about the double validation is that compilation is about doing as much validation up front as possible.. this compilation (source to IL) level validation is arguably the same validation that javascript to native would be.. so the whole point about the compilation step is about removing as much validation as possible.. theres a significant symbiosis between the design and specificationof IL and the jitter.. this step partially exists (perhaps as a bonus side effect) to remove validation.. so I don't buy at all that validation is harder in .NET..

    Other than that it was really interesting.
  • Great video! That you guys can openly talk about a technology from a competitor completely from an engineering and technical perspective is one thing I really love about C9.

    Great work, Charles and Eric.
  • gamefmgamefm no box and no sphere, only humanity as gravity.

    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!!!)

  • Hi,

    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

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.