4 ms·
Which compiles to JavaScript with Dart2JS.
by mythz 13y ago
Which compiles to JavaScript with Dart2JS.
- pcwalton 13y agoThat's correct. There is basically nothing comparable between asm.js (which is a subset of JS with a JavaScript interpreter optimized for it) and Dart (which is a language that currently compiles to JS with no special compiler optimizations in any engine that I'm aware of). When Google starts shipping the Dart VM, then it will be a different story, of course. It will still not be comparable to asm.js, because asm.js runs in all browsers without the site author having to do anything (which would not be the case if Google shipped the Dart VM, as it would then be possible, and convenient, to write pages that only worked in Chrome).
- mythz 13y agoOnly Firefox uses a separate special interpreter (Odin Monkey) for asm.js - Chrome's asm.js improvements come from optimizing the same V8 JS pipeline. Having a separate compilation pipeline can be viewed as a disadvantage since any optimizations for speeding up asm.js doesn't improve JS performance: http://mrale.ph/blog/2013/03/28/why-asmjs-bothers-me.html http://mrale.ph/blog/2013/03/28/why-asmjs-bothers-me.html > It will still not be comparable to asm.js, because asm.js runs in all browsers without the site author having to do anything Dart web apps will continue to run in all browsers just as it runs today through Dart2JS, it even has great source maps support which lets you debug native Dart code even though it's running transpiled JS. There's nothing special the "author" would have to do, it already exists as part of the project template, e.g. if the browser has a Dart VM it will run the Dart code natively, otherwise it will run the Dart2JS version. Since some Dart benchmarks http://www.dartlang.org/performance/ http://www.dartlang.org/performance/ show Dart2JS outperforming handwritten JS in V8 even with the overhead of different semantics, I'm assuming that Dart2JS compiles to efficient JS that developers wouldn't write. > because asm.js runs in all browsers runs is a technically interesting term, there are some asm.js demos that you would not attempt to run without asm.js specific optimizations (i.e. not Firefox) since it would be unusably slow. This is visible in the Epic Citadel http://www.unrealengine.com/html5/ http://www.unrealengine.com/html5/ flagship asm.js demo where it needs a Firefox Nightly release to run. The demo doesn't let you run it in IE10 and whilst it lets you try run it in the latest Chrome, but it crashes. Even Firefox ended up reverting a correction fix (deviating from their JS SpiderMonkey VM) in OdinMonkey because it would invalidate its type checker and cause this demo to run with their normal (i.e. unoptimized asm.js) JS engine: https://plus.google.com/111090511249453178320/posts/cr4jTsfxVg8 https://plus.google.com/111090511249453178320/posts/cr4jTsfx... So whilst it can in theory technically still run since its "just JavaScript", it can currently be either a broken, or unusable experience if you don't use Firefox.
- azakai 13y ago> Only Firefox uses a separate special interpreter (Odin Monkey) for asm.js Not true, Firefox uses OdinMonkey, which type checks the code, but then optimizes it using IonMonkey, the exact same pipeline all JS code uses. > runs is a technically interesting term, there are some asm.js demos that you would not attempt to run without asm.js specific optimizations (i.e. not Firefox) since it would be unusably slow. This is visible in the Epic Citadel http://www.unrealengine.com/html5/ http://www.unrealengine.com/html5/ flagship asm.js demo where it needs a Firefox Nightly release to run. This is simply false. You can run the Epic Citadel demo in Chrome (dev runs ok on my machine for example) and non-nightly versions of Firefox. It is true that the Epic website recommends Firefox Nightly, that is outdated and it should definitely be removed.
- mythz 13y ago> Not true, Firefox uses OdinMonkey, which type checks the code, but then optimizes it using IonMonkey, the exact same pipeline all JS code uses. The special interpreter is what I've inferred from pcwalton's comment of their being an optimized interpreter for it in Firefox. If its the same JS VM how can anything fail the type checker (e.g. forgetting a '+' or '|') cause it to run much slower? http://mrale.ph/blog/2013/03/28/why-asmjs-bothers-me.html http://mrale.ph/blog/2013/03/28/why-asmjs-bothers-me.html and if its the same pipeline, how can an asm.js bug have different behavior to normal JS in Firefox? https://plus.google.com/111090511249453178320/posts/cr4jTsfxVg8 https://plus.google.com/111090511249453178320/posts/cr4jTsfx... > This is simply false. You can run the Epic Citadel demo in Chrome (dev runs ok on my machine for example) and non-nightly versions of Firefox. I've got the latest version of Chrome and it always crashes for me: http://imgur.com/Nrsxsdk http://imgur.com/Nrsxsdk I've tried it a few times and I've never seen it work in Chrome, It even crashes when I tried it in Dartium (a Chromium based browser shipped with Dart SDK). Though I don't have the dev version of Chrome to try it on. > It is true that the Epic website recommends Firefox Nightly, that is outdated and it should definitely be removed. Right, it works in normal Firefox which is what I meant. P.S. it is good to have 2 from the Mozilla elite here to clarify Firefox internals :)
- 13y ago
- dragonwriter 13y ago> When Google starts shipping the Dart VM, then it will be a different story, of course. I've never heard anyone from Google state an intent to ship Dart VM in browser for general use without other browser vendors being on board (Dart VM for running Dart on the server, sure, and Dartium [Chromium with Dart VM] as a rapid-cycle tool for developers, sure), the specific reason being to encourage Dart use by not making it browser specific. Heck, there's no reason, if asm.js catches on for optimized browser support, the preferred-for-client format of Dart couldn't move from compilation to bog-standard JS to compilation to asm.js.
- afsina 13y agoThey are working on changing some internals of Blink project (code name oilpan) so that both Dart and V8 can work better with it. My understanding is that they will ship Dart VM with Chrome once it is ready regardless of other browsers decision. This will probably be post 1.0 tough.
- freshman19 13y agoActually dart2js compiles a "Dart-like" language to JavaScript. The "dart-like" doesn't include big integers or operator overloading on numbers.