Wednesday, March 20, 2013 at 9:45AM

John McCutchan, after a long career spent working on the Linux kernel and being hired out as a code optimization guru, joined Google's Dart team. A curious hire until you watch Bringing SIMD to the Web via Dart, where John makes a programmer accessible explanation of why he likes Dart: performance, performance, performance.

Dart is an open-source Web programming language developed by Google. The motivation for Dart is twofold: provide a language capable of scaling up to the complex web applications that are becoming the norm. Think Gmail. And provide a single language capable of working on both the client and server. Towards those ends Dart is a complete language, full tool environment, and provides an advanced Web UI framework for building web applications at a high level of abstraction.

Why isn't JavaScript good enough? The fear is for large web apps the nature of JavaScript puts crippling limits on potential performance improvements, which will cause web apps to lose out to mobile apps. Before you scream in protest, Dart is created by the same guys who worked on V8, so all their JavaScript experience has fed into Dart.

John’s pitch is that despite many assertions to the contrary, the web is not fast. For example, when comparing the performance of a 2D physics engine across C and the web, the web version is 20x slower than C. Java is twice as slow as C. So the browser is not fast. Dart and the new libraries it supports can close that gap, allowing for the development of high performance applications in the browser.

You may be wondering which of the gazillion web frameworks to use and Dart may just be on the edge of your radar. If so this is an excellent video to take a look at.

Why might you like Dart? Here’s John’s list:

Loves structure and static type checking. Dart has a type system. Strangely though the type system is enforced by tools, it’s not a property of the language.

Class base and object oriented. JavaScript is too flexible.

Lexical this. Unlike JavaScript when you use this you know what it is referring to.

Semicolons are required.

Performance. Dart is designed to run fast by being less permissive than JavaScript.

Newly written from scratch VM that is designed specifically for Dart and is designed to be fast.

In Dart every object has a static shape. In JavaScript fields can be added at any time, which invalidates any optimizations around instances of the class. Not possible in Dart. Remember, it’s less permissive than JavaScript.

Hole free arrays. In JavaScript elements can be added anywhere into an array at which point it will be converted to a map where an index is the key. It becomes sparse and is spread out through memory, which is horrible for performance. Dart does not let you do this.

Distinction between growable and fixed sized arrays. If you know the size of an array ahead of time then you can make it fixed sized array, which gives Dart more optimization opportunities.

No prototype chain in Dart. Big win. In JavaScript you find which method to execute by following a prototype chain. In Dart you extract the class ID go to the class a grab the function. It’s very fast.

Dart has both integers and doubles. Integer arithmetic is 3x-4x faster than double arithmetic. JavaScript pays an unnecessary price for making all numbers doubles.

The rest of the talk is quite interesting and is about him porting SIMD to Dart. SIMD means single instruction multiple data, which means an operation is applied in parallel to an array of data rather than to one piece of data at a time. This makes areas like 3G graphics, 3D physics, image processing, signal processing, and numerical processing, blisteringly fast. Which means you can get console level performance in the browser.

As the point of this post is a quick hit on Dart, you can see the rest of the SIMD talk on the video.

Is Dart the Future?

For Dart to win it must provide speed improvements so compelling that other applications are put at a clear competitive disadvantage, and not just in graphics intensive applications. Then either JavaScript interpreters will need to compete or developers may be forced to move. But this is not an area where Google can get customer wins just by being Google or by being marginally better. Quirky little JavaScript is much loved. JavaScript's ecosystem is both loved and extremely strong. The same ecosystem plays that Google makes in other areas may work against Google here.