How can Google Dart improve performance?

I read an article about the upcoming Google DASH / DART language , which I found quite interesting.

One thing I stumbled upon is that they will say that they will remove the inherent JavaScript performance issues. But what are these performance issues? There are no examples in the text. That's all he says:

  • Performance - Dash is designed with performance characteristics in mind so that you can create virtual machines that do not have the performance issues that all EcmaScript virtual machines should have.

Do you have any ideas on what these performance issues are?

+7
source share
3 answers

One example is the elimination of tail call (I'm sure some people think that this is required for high-performance functional programming ). a function request was added for Javascript VM V8, but this was the answer:

The tail call exception is not compatible with JavaScript because it is used in the real world.

+5
source

This thread should be read for anyone interested in a dynamic language only during compilers: http://lambda-the-ultimate.org/node/3851

Participants in this topic are luajit creator, pypy folks, Mozilla javascript developers, and many others. Pay particular attention to Mike Pall's comments (he is the creator of luajit) and his opinions on javascript and python in particular. He says that language design affects performance. He attaches great importance to simplicity and orthogonality, while avoiding the crazy corner cases that infect javascript, for example.

Many different techniques and approaches are discussed here (tracking jitts, jitt methods, interpreters, etc.). Check this!

Louis

+8
source

This article discusses the difficulties of optimization arising from extremely dynamic languages ​​such as JavaScript, and prototype inheritance.

In languages ​​such as Ruby or JavaScript, the structure of the program may change at run time. Classes can get a new method, functions can be eval () 'ed into existence and much more. This makes code optimization difficult because the structure will never be guaranteed.

Prototype inheritance is more difficult to optimize than traditional class-based languages. I suspect this is due to the fact that many years of research and implementation experience for class-based virtual machines.

Interestingly, V8 (the JavaScript JavaScript engine) uses hidden classes as part of its optimization strategy. Of course, JS has no classes, so arranging objects in V8 is more complicated.

The layout of an object in V8 requires at least 3 words in the title. In contrast, Dart VM requires only 1 word in the title. The size and structure of the Dart object is known at compile time. This is very useful for VM developers.

Another example: Dart has real lists (aka arrays). You may have a fixed-length list that is easier to optimize than JavaScript, rather than arrays and always variable lengths.

More on compiling Dart (and JavaScript) for efficient code with this presentation: http://www.dartlang.org/slides/2013/04/compiling-dart-to-efficient-machine-code.pdf

Another performance parameter is startup time. As web applications become more complex, the number of lines of code increases. JavaScript design makes run optimization difficult because parsing and loading code also executes code. At Dart, the language was carefully designed to make it out quickly. Dart does not execute code when downloading and analyzing files.

It also means that Dart VMs can cache the binary representation of the analyzed files (the so-called snapshot) for even faster startup.

+6
source

All Articles