- Lars Bak
- Kasper Lund
- AJ O’Neal (twitter github blog)
- Charles Max Wood (twitter github Teach Me To Code Rails Summer Camp)
- Joachim Larsen (g+ github website)
- Virtual Machines
- OOVM – Embedded Smalltalk
- V8 is implemented in C++
- Who’s behind Dart
- Adaptive compiler
- V8 source code
- Palm phones based on V8
- Mobile considerations such as resources and speed
- Strict mode
- the “with” statement
- deleting a property is “dog slow”
- Why Dart?
- JS closure compiler
- More declarative
- Startup time
- Peak performance
- 10x faster startup
- Dart vs CoffeeScript
- non-local return
- Scripting and Web development gives you instant gratification
- VM’s targeting the native language will almost always be faster
- Native Client
- Bloggers (AJ)
- Class-Central.com (Joachim)
- Memrise (Joachim)
- This is Your Life Podcast (Chuck)
- Fitbit (Chuck)
- dartlang.org (Lars)
- Silent Sleep for Android (Kasper)
AJ: Yo, yo, yo, coming at you live from the Orem, Utah.
CHUCK: [Chuckles] We also have Joachim Larsen.
CHUCK: And I’m Charles Max Wood from teachmetocode.com. Our guests this week are Lars Bak and Kasper Lund from Denmark.
LARS: That’s correct. Thank you for inviting us.
LARS: Are you referring to Dart or V8?
CHUCK: Okay. All right. Are the two connected in anyway? I’m a little curious.
KASPER: But they are not related on the implementation side.
JOACHIM: So I mean you guys built the whole career basically on building great VMs is that right? How did you guys started on that?
LARS: Oh, that goes all the way back to ’86 you were probably not born at that point in time, but that’s when IE started building virtual machines for program called BETA, which was sort of a success—
KASPER: It was Google’s first project missing the whole thing where Google’s programs are always in beta. Anyway, sorry go ahead.
LARS: [Laughs] That was funny. It was the BETA programming language; that was a success up of the — 67 that was my first virtual machine. And after that, I got a taste for it. It’s very interesting to just tune the black box making a programming language run fast. And then I joined afterwards a project at Sun Microsystems research lab. And then that was at that point the most interesting implementation project I could find where they came up with very interesting ideas to make dynamic languages run really fast, and I came up with adaptive compilations, polymorphic and stuff like that. That’s like when you do fast implementations today. And then I went to a start up in Silicon Valley where with did a system called StrongTalk which is a variant of Smalltalk with optional steady types. And then Java came along and we decided in the startup to spend most of our time doing a Java implementation.
JOACHIM: So just a quick question – sorry – so Strong talk development was basically geared towards mobile and embedded platforms. Is that right?
LARS: That’s not true. That’s four projects later; that was a Smalltalk system called OOVM. That was my second Smalltalk project. Now Strongtalk was for desktop systems. Anyways, we did hotspot and sold the start up to Sun Microsystems and then that became the default JVM for Java. And I still believe it’s still running somewhere even after it was sold to Oracle. So after that, I moved back to Denmark and that’s when I hooked up with Kasper. He was a student at the University.
KASPER: Yeah I got hired in that point to help on a new Java VM for mobile phones and so we did that together here in Denmark. And before we decided that it was time to move away from JVMs and do something even cooler.
LARS: Well, that was a few projects in between, but I think from my point it was after implementation two Java virtual machines was sort of getting a little bit annoying; doing the same thing over and over again even though the second JVM was for mobile devices.
LARS: And for me, it was the time to sort of leave big companies and try a startup. And that’s why we did the embedded Smalltalk system called OOVM. This was a tiny Smalltalk system (multi-threaded) that ran in say a few hundred kilobytes of memory.
KASPER: Yeah, those are very different system than the server system that Hotspot became and so this is a very simple Smalltalk execution environment for embedded devices. It has some really nice properties, like you can change code on running devices even if you are only connected through them via wireless connection and stuff like that. So it was kind of neat for small embedded devices.
LARS: And that’s also the way we learned the lesson that if a programming language does not have curly braces, it’s where you have to convince people to use it.
AJ: No kidding, right?
KASPER: Yeah. One generation later, it’s very hard to get people to use curly braces.
CHUCK: Right. So what is V8 written in? Is it in C or C++?
LARS: It’s written in C++ and the reason why we are using only a subset of C++ and it’s mainly to have a programming language that supports abstract data types. If you use C, it’s very complicated to change implementation without rewriting the whole system.
KASPER: In addition to being written mostly in C++, it’s also a fairly big component of V8 today that is actually generating machine code. So essentially, fairly big chunks of V8 is hand tuned in the machine code that we generate on the fly. So there is a sort of symbolic assembler written in C++ code that can admit binary instructions on the fly.
LARS: But generate if from C++.
KASPER: Generate it from C++ but essentially you are writing a machine code through C++ that way.
CHUCK: Is that kind of a just in time compiler or is it different?
LARS: Yeah. Well, there’s a just in time compile on it, but there’s also an adaptive compiler that does on the fly profiling of the and detects hotspots in the program and then optimizes the hotspots.
CHUCK: Mh-hm. So, my understanding is that Node.js is actually based on V8; is that correct?
LARS: That is completely correct.
CHUCK: So, did you ever really intend for it to go toward the server or are you surprised? What’s your kind of reaction to that?
LARS: We were surprised and we were happy at the same time.
LARS: And very early on in the V8, we decided to open source it and we also want to have a clean API that was not tied to the browser. And I think that paid off in some respects. First, it turns out that somebody shipped a phone based on V8 without us knowing it — and that was the Palm phones.
And then Node.js came out on the server side and then it’s pretty cool. And it basically they just took V8 without us knowing it and integrate it on the server side. Of course over the last two years, they have sort of wanted a bigger heap and stuff like that because they are running on the server side and we’ve been trying to help them out in few areas, but that’s pretty much it. So having an open API that people can use certainly pays off.
JOACHIM: Timing there was pretty amazing because when you look at what Ryan himself said that at the time he’d actually wanna base it on something like Haskell or something else and then he just basically saw, read about V8 and then were like, “I’ll try that.” And here we have Node.js and so if you guys were a little bit later and maybe even earlier, then we wouldn’t have Node.js — which is something to think about.
AJ: I think one of the best things it’s done in that regard is brought better architecture because people instead of always designing every project as a 20,000 long file by designing these modules and build them together more.
CHUCK: Yeah you can make that argument for just about any language if it’s well thought out architecture but, you know, it’s interesting that I think Node kind of pushes you that way more than some other languages do.
LARS: And you forget speed.
CHUCK: Oh, absolutely.
JOACHIM: Oh definitely. I mean if you look at the development that increased. I think when Chrome came out, it was about three times faster than FireFox or twice at least, and right now we are getting at a point where not only in Chrome and V8 gotten faster but the others are mirroring it.
LARS: Maybe not too much, but getting fast at least.
CHUCK: Well it’s also its also interesting the fact that open source it, so they can actually go and look and see what you did.
LARS: Yeah. And I think it’s sort of a friendly competition that we disclose anything we do so people can take it if they want to or just look at the ideas. One thing that’s important is that we want to make the browser world better for everybody because it’s a fact that the web application developers, they program against the lowest common denominator. So if you have a browser that’s slow but has a big market share, the developers will program against that. And it doesn’t really matter if one browser has the speed, everybody needs to be beyond a certain bar before it matters
KASPER: Yeah, definitely.
CHUCK: Right. Are you thinking of any browsers in particular? IE maybe IE?
LARS: Absolutely not.
JOACHIM: Well I mean there’s also that and there’s also this now that we are getting into program for mobile devices, there’s not only the question of having slower browsers, but also having more constrained environments where performance means that much more.
CHUCK: Yeah. Is V8 in Chrome for mobile?
KASPER: Oh yeah, of course. There’s also in the old browser for Android.
CHUCK: Oh, nice.
KASPER: Of course it’s nice.
KASPER: We actually try to push the performance of V8. It actually has an impact on our own cellphones. It’s kind of nice. You can feel the increase of speed there on the device you have on your pocket.
JOACHIM: Is that something that drives you personally as a developer that you actually include in your own tool chain in a way that you wanna experience of writing that you were developing in Smalltalk previously as well?
LARS: It matters a lot, right? The fact that a new version of Chrome is coming out in six weeks is amazing as a developer, right? You are excited about speeding up a certain part of the browser and run faster, your code is out and used by millions of the users. It’s fantastic. It certainly helps the excitement going on the team. And it keeps you very, very honest, right? If you push something that’s great, some people will notice and if you push something that’s not as great, if you actually real box, you will know too. It’s very humbling.
AJ: So I’ve got a question for you guys about strict mode; Douglas Crockford said that if “with” was taken out of the language, that the language can be made much faster. So is V8 going to become faster for strict mode code?
LARS: So was that a VM implement again that said it could be faster?
LARS: So it does not matter at all.
KASPER: So of course V8 optimizes functions that do not contain with in a different and create a function that do contain with. So as long as you are not using it, you are actually not paying for the feature. You are just bailing out the optimization side more when you use with statement because you have a very dynamic scope and you have to demand dynamic lookup of locals and so forth.
CHUCK: I have to ask my new question real quick, what is a “with statement”? What does it do?
KASPER: The with statement is a program construct that allows you to essentially put in any kind of object into your scope chain so that when you have a references to like the local variables inside a scope, it will start out by asking that certain object if it has that property and use that as [inaudible] essentially. So like you can add new objects to your scope that way. So it’s very hard for VM to optimize that well because you don’t know the structure of the object you are adding to a scope chain at all.
LARS: And an object can change on the fly. So it basically boils down to you have to do a dynamic look up whenever you are looking for something in your scope.
CHUCK: Which of course is non-optimal?
LARS: Yes. It’s dog slow.
CHUCK: [Chuckles] Is that a technical term? I think I’m going to start using that.
LARS: It is now.
CHUCK: “Mr. client this is dog slow, I got to fix it.”
AJ: So what do you do then if you want to delete a property? Like what would be the fast way to have that effect? To sign undefined?
AJ: Interesting. Very interesting.
AJ: [Laughs] That’s actually good.
CHUCK: That’s not as funny. Come one guys.
LARS: Come on, the way it works is that we—
CHUCK: V7 was taken?
LARS: I was with Kasper and we were trying to create the name for the source repository. We need something short and it was called Chrome and under Chrome we need a big engine, so we called it V8.
CHUCK: Oh, there you go. That makes sense.
LARS: So that was pretty much it.
KASPER: And I tell you, one of the biggest challenges in computer science is coming up with the initial name for the directory.
LARS: So what’s interesting at Google we can maintain the internal code name too on the outside as well, which is cool. So it stayed V8.
JOACHIM: Is that from cache or you are taking network traffic into account or do you mean just even if it’s in cache its going to take a long time?
CHUCK: So one question I have then is there isn’t a Dart VM in my browser or at least I don’t think there is.
LARS: [Inaudible] what you call Dartium. We have a build of Chrome with native Dartium inside it.
LARS: Well that’s two questions; one is yeah, if we could convince the other browser to use the Dart VM and hopefully so. But we cannot make that call; they have to want it themselves.
KASPER: Of course we are also making the VM available with a nice embedding API and its fully open source. It’s out there and being developed in the open. So hopefully, people like in the Node.js and people involved in that or similar people will find and use it for something else that we haven’t imagined yet. And so, at least that was one of the very positive things about the V8 project was that we encourage people to use it without us knowing or trying to control. That was really nice to see.
CHUCK: Yeah that was the next question I was going to ask is do you see maybe Dart going the same way that V8 did in something like NodeJS or maybe smbdy using it on a phone and creating a mobile VM that people can do something other than web stuff with?
LARS: Certainly. We have an embedding API, so people can start using for various purposes. And we think that’s fine. One thing you can ask us is, [chuckles] “What are you trying to do with Dart?”
So certainly getting these extra properties in when you do web application is nice, but also we think that if you want to improve the web platform move forward, like innovation is very important. And our small project Dart is trying to innovate in the browser maybe new language trying to make it more efficient for the programmers to do applications and so on. So that’s a certainly our plan.
JOACHIM: Why would browser vendors be more likely to accept Dart in something like your native client for example another Google project?
LARS: Native client does not intact with the DOM, right? It’s sort of in a separate space. One is on sandbox and native client—
JOACHIM: I was going to say that that’s something that could be overcome, couldn’t it?
KASPER: Yeah, but it’s hard to speculate on why other browser vendors would want to pick up technology and why they would not make up other stuff. It’s really hard.
LARS: There’s many reasons for that, I would say.
JOACHIM: Is it in terms of patents and rights and stuff like that?
JOACHIM: Yeah that seems more to do with the fact that people kind of didn’t really like using HTML as a UI. We’ve had a long, long period of using XML and all the kinds of things for doing UI sketch ups.
JOACHIM: The reason that I asked is of course I’m sure that your work performance on Java the JVM now has a very rich ecosystem of Ruby and Scala and Closure and it’s basically the opportunity that people can write in whatever flavored language that they want and have it run everywhere. And I’m just kind of thinking now that we are in iteration with ECMAscript is being… they wanna have all these strange constructs and you guys are doing Dart. Couldn’t we see a situation where there’s a generalized VM that other language can build within the browser?
LARS: Oh, you want to do a multi-language VM?
JOACHIM: I’m just wondering why that path wasn’t kind of, gone down?
JOACHIM: So that’s what the developers agreed to make, right? You can choose if you wanna have a quick implementation or they wanna have good performance; same like not naming names here, but like Ruby and PHP or what not.
LARS: So we are working in a company, right? And when you start on sort of multi-language projects, it sometimes turns into this research project that takes many years to do. We are a small group here that had to do V8 and focusing on only one language had the benefit; we could easily reach the target. And that’s pretty much it.
JOACHIM: From the outside, it seems to me that right now, JVM actually does give developers that freedom where they can choose if they wanna write in json or they wanna do with jruby or Scala or closure or standard Java.
JOACHIM: JRuby is faster than normal.
CHUCK: Yeah but that has more to do with the implementation than the actual… like the way that MRI Ruby is implemented, it has more to do with some of that than it does to do with the fact that it’s written on the JVM versus written in C and compiled.
AJ: So kind of like the difference between writing web server that’s using event-based serving and the one that’s using thread based?
CHUCK: Right. In the sense that you know, they are using different paradigms to manage different processes and issues and yeah, so there are different issues between the two VMs in the way that they are put together.
AJ: So, a question I’ve got while we are on this topic is so Google has started Go-lang, they started Native Client, now they starting Dart. It seems like at least two of them are definitely direct competitors between Native Client and Dart, like they seem either try to serve the same purpose and get the browsers super-fast and make it easy for people to integrate. And then in Golang, it doesn’t look like there’d be any problem with putting that in the browser and I was kind of hoping originally when I heard about it that that will be the direction it would go. So why are there so many different directions that Google is going in right now?
LARS: Well, I would say that we are just happy that we are in a company that invests so much in programing languages so that programmers can get their best choice. I don’t see a problem at all. I think it will be sad if we sort of step down and only be stuck with one language.
AJ: Well I’m thinking in terms of adoption, right? Like I can’t use Dart until FireFox implements it, right? Who cares about IE? There’s a lot of applications where you can just focus on browsers.
AJ: What was that?
AJ: But not getting the full benefit of it.
LARS: Well, but it still runs
KASPER: Also we don’t really see Dart and Native Client as competing technologies; they are very, very different and Dart is a scripting programming language that is very immediate; you can write your code and you reload your page and its right there, and Native Client is a different kind of technology and it’s great for translating C code to something that runs in your browser. It’s very different, at the core of it.
CHUCK: So my question what do you see people doing with Dart these days, generally?
LARS: Well, first of all Dart is not a food product, right? We send out a preview in the fall last year and we are working hard on maintenance we are in beta basically. We can see from the inside that people have start building applications — web applications — using Dart. So, hopeful soon we can send out a robust version; an SDK you can use to do web apps with. That’s basically our goal; we want to improve the way you do web apps.
CHUCK: So nobody’s actually using it in production yet that you know of?
LARS: Not that I know of, but it’s well, it’s a technology preview so, I don’t think it’s right time to build products on top of Dart.
LARS: Not on the outside, right? But we’ve got feedback from the community using Dart and so far it’s very good, the feedback. People are mostly trying it out, making small apps but not for commercial use yet.
AJ: So is there a package manager that has gained traction in the community for Dart or is it still just kind of adhoc right now?
LARS: Currently there’s none. If you stay put for a few weeks, you will see one.
AJ: Oh nice.
CHUCK: Are you working on one? Or do you know someone who is?
LARS: We are working on making one; a simple one and it will be out in the open source repository. So if somebody has one faster than us, submit it and we’ll get it into the workspace.
AJ: Just make sure you don’t put your users table public facing.
CHUCK: [Laughs] Oh, man. You had to go there didn’t you?
CHUCK: All the Node people are crying for a whole day — or three.
JOACHIM: Let’s pretend it didn’t happen. Act like you are sorry. [Chuckles] So you guys have a pretty big team. I hear you guys have about 80 developers working on the language itself and you have a very active bug tracker? How do you kind of balance the long term goals and you know, what people are clamoring for in his project?
KASPER: And a lot of things that we spent a lot of time on is actually trying to get the most of and the best value out of the feedback that we do get from the community. And so you see a lot of us interacting with the people on the issue tracker and through code reviews and working with people and not just from Google. So it could be that you are team size is pretty accurate if you count people not working for Google too.
LARS: So the interesting part is we decided very early on to open source it and we in the Dart team work exactly the same way as with the V8 team, whenever we have a change list to the repository, it will be send out in the open right away. So we do everything in the open — and hopefully that will benefit the community.
CHUCK: Yeah that’s—
JOACHIM: The language features and stuff and feedback, I heard that there’s a lot of desire for mix-ins. Is that something that you are thinking about or is that just not going to happen?
LARS: There’s a lot of request for different language features and the problem is that you have to be careful not to have too much into the language. Like we all really have interfaces and classes so if you also add mix-ins right? Is yet another way of combining code. So we are trying to be careful not to just add new constructs in and we like to keep the language very simple. And right now it is still very simple and its sufficient for writing webs apps.
CHUCK: All right. Well, I need to start wrapping this up. After we end the podcast, if you guys want to keep talking that’s fine, I’ll just leave it recording and you know, we’ll just post anything else that you have to say afterward in some bonus content because its sounds like Joachim has a few more questions. But I have and appointment in about 15 minutes.
LARS: That’s okay.
CHUCK: What we usually do at the end of the podcast and I should have emailed you and told you this, but I’ve been swamped just preparing for podcast and preparing for a couple of talks. I’m speaking at a conference this week and alternate speaker at one next week, so I’ve just been trying to get all that together.
But what we do is we usually “pick” some items, it can be anything from TV shows to programing tools. You know, just some things that we like, things that make our life better, things that are kind of interesting or fun and you know, just share them with the community.
So what I’ll probably do is just have the regular panelist go first and share their picks and that way you can think about what you want to tell us that you like and tell people to go try out. So AJ, what are your picks this week?
AJ: I love bloggers. They make my life easier. I just love it when people write documentation for something, for me to find to get myself out to fix. I was working on—
CHUCK: The rail road?
AJ: Yes. I was working on the Railroad and there were some shared workers there, there were some desktop notifications there and there were some session storage there.
CHUCK: Cool. Rail road.
AJ: That’s right. So there’s just a couple of blogs I found that really helped me out. I don’t remember what they are at the top of my head, but Google searching. And so I’m very grateful for all your people that are helping the rest of us get smarter.
CHUCK: All right. Anything else?
AJ: That’s it.
CHUCK: Okay. Joachim, what are your picks?
JOACHIM: Well I’ve been kind of, you know into the whole self-improvement thing or what not, and so I’m going to have to say Class-central.com Class hyphen Central. It’s basically a collection of free courses from MIT and from many other universities that offer free course.
And then also Memrise, it’s actually pretty interesting. I’ve been living in Thailand for quite a few years now and it’s the first time that I actually is seriously learning the Thai alphabet. [Chuckles] It’s got like 88 characters. Anyway–
CHUCK: Uh-huh. That’s Memrise? M-e-m-r-I-s-e?
JOACHIM: That’s right.
CHUCK: Okay. Well I’ll go next. For those of you who don’t know, I’m a huge podcast junkie. I listen to podcast all day long and I recently found one that’s called this is your life and it is by Michael Hyatt who used to be the CEO of Thomas Nelson publishing which is the largest Christian publishing company here in the United States. I think it might be the largest publishing Christian company in the world, I’m not sure.
But anyway, I think he left his position there and he is just out speaking and doing training and things. Anyway, This is Your Life Podcast he goes into a lot of things as far as improving your life in different ways and he usually has like ten things that help you with whatever the topic is. And he’s only put out three episodes so far, but every single one of them has been worth it and I’ve actually… I need to go back and listen to them again because they are just that good with managing your life and things like that. So just a terrific, terrific podcast.
And then the other thing is my wife bought me — for our anniversary which is on Sunday — Fitbit which is this little device that you carry around with you and it tracks your activity and things’ like that. And it’s been really nice it actually tracks your sleep too, so now I know it takes me about 6 or 7 minutes to fall asleep and that I need to get more of that – more sleep. So, but it’s really cool; it also tracks your activity when you go to the gym and it says you were really active for this many minutes and you were somewhat active for this many minutes and you were sedentary for most of the day.
So you know, really interesting stuff and I’ve really been enjoying that. And now we’ll go ahead and put our guests on the spot. Lars do you have any pick? Anything that you’ve been playing with or enjoying lately?
LARS: Yes and I’m surprised you haven’t mentioned it yet. If you go to dartlang.org and try out our new language and then post your feedback, it’s actually very cool. People have religious attitude towards programming languages, but they should try Dart and see how it is.
CHUCK: That’s true. You are starting a new religion.
KASPER: Yeah. I have a kind of different thing; I recently installed a piece of software on my phone that makes it go silent at night; and that’s great. At ten in the evening it will go silent and it would turn on the volume again the next morning. That’s a blessing. It’s highly recommended.
CHUCK: What’s it called?
KASPER: I think something like that. Silent Sleep. There are a bunch of them sand I think they all do the trick. Just turn and silent at night, sleep better.
CHUCK: So my only question is if I’m out late, is there any way for me to tell it, “Stay quiet unless my wife calls?” [Chuckles]
KASPER: Yes of course. You can put in all these blacklist and whitelist if you care to.
CHUCK: All right. I like that. Wife = white list. Mom = black list.
LARS: You can also do the [inaudible] its better.
LARS: Congratulations on your anniversary Chuck.
CHUCK: Oh thanks, it’s been a long seven years. I’m just kidding.
And we also appreciate comments so if you have anything you want to add, thoughts that you have on Dart or anything like that, go check it out at dartlang.org. And also leave a comment here and let us know that you checked it out and what you thought because I’m really curious to see what people think of this new language.
So with that, we will wrap this up and catch you next week!