12 ms·
Dart's performance is pretty good; its authors are VM geniuses. If it doesn't already[1], it could leverage the optional typing for block versioning on initial
by PeCaN 11y ago
Dart's performance is pretty good; its authors are VM geniuses.
If it doesn't already[1], it could leverage the optional typing for block versioning on initial compilation, and assume that version is correct most of the time (generating the most-optimized version initially because you expect to not bail out of this block version). This way you wouldn't have to warm up for type inference. If the program type-checks you can get almost static type performance.
Dart also has an advantage in app startup time since you can just load your snapshot.
--
1: I'm not familiar with the internals of the Dart VM, but I don't believe it leverages block versioning[2] at the moment. That seems like a low hanging fruit when you already have type hints. Your initial baseline compile can generate a specialized version from the get-go then lazily add other blocks if the type hints are wrong.
2: http://arxiv.org/abs/1411.0352 http://arxiv.org/abs/1411.0352
- incepted 11y agoThe Dart authors are geniuses but even they can't violate the laws of physics. Dart is between two and five times slower than Java, as of six months ago [1]. It's not clear whether Dart can close that gap since Java is not standing still either, so I remain completely unconvinced that Dart will ever be the replacement of Java on Android. [1] http://benchmarksgame.alioth.debian.org/u32q/dart.php http://benchmarksgame.alioth.debian.org/u32q/dart.php
- PeCaN 11y agoIt's not in any way a physical limitation that Dart is slower than Java. It's just somewhat harder to make fast, and even then, some of Dart's design is motivated by being able to implement the language efficiently. [1] Dart could even in theory have a compiler that assumes all your type annotations are correct and simply AOT compiles your code. (So your workflow would be: develop -> fix type errors -> run in regular VM -> loop -> AOT compile -> deploy.) Whether that would be useful is another matter, but it could certainly be possible (some Common Lisp implementations in fact do exactly this [2]). -- 1: https://www.dartlang.org/support/faq.html#q-why-dart https://www.dartlang.org/support/faq.html#q-why-dart 2: http://www.sbcl.org/1.0/manual/Declarations-as-Assertions.html http://www.sbcl.org/1.0/manual/Declarations-as-Assertions.ht...