As me1000 (Randy Luecke) says Dart is not meant for hello world. If you run this through closure-compiler it's reduced to 2000 lines which is nothing next to Underscore, jQuery, Dojo, etc. We all know the benefits of offloading code to a well known and well tested library or framework, especially if you're writing an app that is thousands of lines anyway. How is this contentious at the end of 2011 unless you're just…
..and here's the jsperf for the --optimize'd hello world vs. vanilla JS - http://jsperf.com/dart-hello-world-test-with-optimize/2 . 17k vs. 4M for me
"Hello World" in Dart, compiled to JavaScript
31–40 of 162 posts
Re: "Hello World" in Dart, compiled to JavaScript
#32Earlier quoted context omitted.
..and here's the jsperf for the --optimize'd hello world vs. vanilla JS - http://jsperf.com/dart-hello-world-test-with-optimize/2 . 17k vs. 4M for me
Got any useful benchmarks? Nobody is wondering which language to write their next "hello world" app in. Just for the record I'm not saying Dart is amazing and everyone should use it, all I'm saying is that we should evaluate it objectively. If raw speed is your bottleneck then why are you wasting time evaluating Dart? Nobody is forcing anyone to use it, you can ignore it and move on with your day.
Re: "Hello World" in Dart, compiled to JavaScript
#33same code in coffeescript (@ preceding testMain makes it a static method and it looks like print in Dart converts to console.log) class HelloCoffeeTest @testMain: -> console.log "Hello, Coffee!" HelloCoffeeTest.testMain() resulting js var HelloCoffeeTest; HelloCoffeeTest = (function() { function HelloCoffeeTest() {} HelloCoffeeTest.testMain = function() { return console.log("Hello, Coffee!"); }; return HelloCoffeeTes…
Does CoffeeScript have all these data structures, http://www.dartlang.org/docs/api/index.html ?
Re: "Hello World" in Dart, compiled to JavaScript
#34Earlier quoted context omitted.
Oh yeah, 2300 lines of gibberish JS and FSM only knows how many global variables and functions is a real improvement. the original example should "compile" to nothing more than the following: (function () { window.HelloDartTest = { testMain: function testMain() { console.log("Hello, Darter!"); } }; HelloDartTest.testMain(); })();
This is false. It is like claiming that it "should" really compile to just console.log("Hello,Darter!"); They're functionally equivalent so why not right? Dart was designed for big apps. Google is not aiming at optimizing all the Hello World pages. Every single framework in existence has terrible size characteristics for Hello, World. Loading all of Foundation and UIKit for showing Hello World on the screen in iOS? I…
Re: "Hello World" in Dart, compiled to JavaScript
#35Re: "Hello World" in Dart, compiled to JavaScript
#36Earlier quoted context omitted.
..and here's the jsperf for the --optimize'd hello world vs. vanilla JS - http://jsperf.com/dart-hello-world-test-with-optimize/2 . 17k vs. 4M for me
...and your benchmark makes no sense. You're creating the entire Dart environment every time.
Re: "Hello World" in Dart, compiled to JavaScript
#37Earlier quoted context omitted.
Oh yeah, 2300 lines of gibberish JS and FSM only knows how many global variables and functions is a real improvement. the original example should "compile" to nothing more than the following: (function () { window.HelloDartTest = { testMain: function testMain() { console.log("Hello, Darter!"); } }; HelloDartTest.testMain(); })();
This is false. It is like claiming that it "should" really compile to just console.log("Hello,Darter!"); They're functionally equivalent so why not right? Dart was designed for big apps. Google is not aiming at optimizing all the Hello World pages. Every single framework in existence has terrible size characteristics for Hello, World. Loading all of Foundation and UIKit for showing Hello World on the screen in iOS? I…
Re: "Hello World" in Dart, compiled to JavaScript
#38Earlier quoted context omitted.
This is false. It is like claiming that it "should" really compile to just console.log("Hello,Darter!"); They're functionally equivalent so why not right? Dart was designed for big apps. Google is not aiming at optimizing all the Hello World pages. Every single framework in existence has terrible size characteristics for Hello, World. Loading all of Foundation and UIKit for showing Hello World on the screen in iOS? I…
compilers are supposed to optimise what they spit out, so why is this spitting out either a) terribly inefficient code or b) a whole heap of un-used code?
2. The reason for spitting out "inefficient" code is already described in my post. This is inefficient for Hello, World. That's fine, it may be the proper tradeoff for efficiency in more complex code. Take CocoaTouch for example. If you write a HelloWorld app for iOS and profile it, you could say "why on earth is this app reading in preferences, sending out didLaunch delegate messages, etc etc etc. Doesn't the code KNOW I don't need that and all I want is to show one string". This is an acceptable tradeoff, because all those things its doing are useful for more complex apps. No one is shipping HelloWorld, so who cares if its slower than the best possible HelloWorld? Is it possible to write a compiler so smart that it would even make HelloWorld super small and fast. Sure, maybe, but those engineering resources are much better spent working on problems real applications face. I'd much prefer Apple focus on scrolling performance than HelloWorld. And similarly, I much prefer Google focus on the problem of writing huge web apps that still perform really well, since thats the remaining unsolved problem for the web.
Re: "Hello World" in Dart, compiled to JavaScript
#39Re: "Hello World" in Dart, compiled to JavaScript
#40As me1000 (Randy Luecke) says Dart is not meant for hello world. If you run this through closure-compiler it's reduced to 2000 lines which is nothing next to Underscore, jQuery, Dojo, etc. We all know the benefits of offloading code to a well known and well tested library or framework, especially if you're writing an app that is thousands of lines anyway. How is this contentious at the end of 2011 unless you're just…
Underscore is under 1000 lines unminified and with all comments.