Why Dart Comes with a Virtual Machine
Dart comes with a high-performance virtual machine. This controversial decision led to questions if it is going to break the Web. In this article I want to look at why we need this virtual machine, and how it can be added to Chrome without breaking the Web.
One place where even the strongest opponents of Dart will not mind using the Dart VM is the server side. The Dart execution model is very similar to the one in Node.js. In addition, the Dart virtual machine is already much faster than V8, and also has a good concurrency story. All this makes it a good candidate for writing high-performance IO-intensive services.
- The compiler is fast, but naive.
- The compiler is advanced, but not as fast.
Embedding the VM into to browser gives you better performance and start-up time. I am not talking about marginal gains here. It is about twice as fast comparing to V8, and the start-up time for some apps can be speeded up by a factor of ten. Both are extremely important, especially on mobile devices.
The issue that rightfully concerns many programmers is how do we make sure Dart developers provide the compiled-to-js version of their programs. Only in this case their applications will work in all modern browsers.
How not to break the Web
Having a dedicated VM has a lot of benefits:
- The VM can be used on the server side.
- The VM can be used to speed up development process.
- The VM can be shipped to the browser to improve the startup time and the speed of applications, and it can be done without breaking the Web.