Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #7332

Re: Google Dart Released Today

From Scott Sauyet <scott.sauyet@gmail.com>
Newsgroups comp.lang.javascript
Subject Re: Google Dart Released Today
Date 2011-10-13 04:46 -0700
Organization http://groups.google.com
Message-ID <1b932719-e4cc-4daa-ae91-ed3df7265533@o19g2000vbk.googlegroups.com> (permalink)
References <cb47d781-dc6b-4e5b-9ccb-6e1d18edcf3b@l30g2000pro.googlegroups.com> <1094da0d-f929-49ec-9875-1096cb4ff481@db5g2000vbb.googlegroups.com> <6ff9c23e-a7d9-42fe-9e86-8799eddcfd93@6g2000prh.googlegroups.com> <c1b545ef-4fa2-4e47-b555-396facc6b6c2@j20g2000vby.googlegroups.com> <Xns9F7D5F12F3F07duncanbooth@127.0.0.1>

Show all headers | View raw


Duncan Booth wrote:
> Scott Sauyet <scott.sau...@gmail.com> wrote:
>> dhtml wrote:
>>> Michael Haufe wrote:
>>>> I think the generated code is a minor issue in comparison.
>
>>> Take a look at this code and then tell me if you have a different
>>> opinion:https://gist.github.com/1277224
>
>> FWIW, I posted the results from a code-coverage tool [1] at
>
>>    http://scott.sauyet.com/Javascript/Test/2011-10-12a/?HelloDartTest.html
>
>> According to JSCoverage, 31% of the generated code is executed when
>> the script is run.
>
>> I can't figure out whether to cry because that is so low, or because
>> it is so high.
>
> You should do neither. That output example posted on github was the
> hello world program compiled with all optimisations disabled. As such it
> is not suprising that it includes the complete Dart runtime library.

That makes sense.  Thanks for the information.  I haven't had time to
really look into any of this.

> Debug compilation adds in a lot of type checking code that isn't present
> at all in a production build and it also keeps all of the unused classes
> and methods around.

Yes, although even then, 17,000+ lines of code sounds a lot.


>> Digging into the details, though, a lot of what is run is the function
>> declarations and named function expressions, rather than the actual
>> bodies of these functions.
>
> Yes, so if you allow the optimiser to run you lose those function
> declarations for the cases where Closure can tell for certain the code
> is never used. You still keep a fair bit of the runtime support so
> there's no way you could call the output lean but the optimised
> Javascript is only 5% as long as the one posted on github and 39 lines
> instead of 17297.

That is a heck of a lot more palatable.  Is there a somewhat fixed
overhead, or does the ratio of source lines of code to generated ones
remain relatively constant?


> A possibly fairer comparison is to compile with
> optimisation turned on and the '--human-readable-output' option which
> results in 2188 lines that are arguably just about readable.

Once again, through, something seems really strange.  When
Coffeescript compiles to Javascript, the output source code in my
experience is 1.5 - 3 times the size of the input source.  That's
certainly acceptable, as Coffeescript is clearly a higher-level
language than Javascript.  Dart seems to be a slightly lower-level
language.  Why does it need so many lines to make a readable format?


> Perhaps those numbers will improve further before dart is actually
> released, but if browsers ever include native support they become
> irrelevant anyway. I think a lot of the code left after optimisation is
> the isolate worker code since even as simple an example as hello world
> runs in a Dart isolate.

I haven't read enough yet to know if that is optional or if it
integral to the Dart environment.  Could this code have been written
(or compiled) in a manner that didn't involve that abstraction?


I wonder about the abilities of the compiler, though, if it generates
code like Garrett pointed out earlier:

| Array.prototype._indexOperator$$named_ = function($n, $o, index){
|   var seen = 0;
|   var def = 0;
|   if (seen != $o.count || seen + def + $n != 1)
|     $nsme();
|   return Array.prototype._indexOperator$$member_.call(this, index);
| }
| ;

Shouldn't some simple static analysis remove `seen` and `def`?

My biggest problem is that I simply don't get why anyone should be
interested.  Obviously Google can add a new runtime to its browser if
they choose.  But I don't understand the feature set, nor the notion
of optional type safety, nor the reason to write another language at
approximately the same level as Java and C#.  Clearly if they want
such a language to have any chance of succeeding beyond a Chrome-only
niche, they need to include the JS-compiler, but the output shown so
far is... well, absurd.  I certainly won't count it out, but I would
have been much more interested if the new language went in direction
of the current dynamic language renaissance.

  -- Scott

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Google Dart Released Today dhtml <dhtmlkitchen@gmail.com> - 2011-10-10 10:44 -0700
  Re: Google Dart Released Today "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2011-10-10 14:24 -0700
    Re: Google Dart Released Today dhtml <dhtmlkitchen@gmail.com> - 2011-10-10 22:36 -0700
      Re: Google Dart Released Today David Mark <dmark.cinsoft@gmail.com> - 2011-10-10 23:41 -0700
      Re: Google Dart Released Today "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2011-10-11 05:33 -0700
        Re: Google Dart Released Today dhtml <dhtmlkitchen@gmail.com> - 2011-10-11 14:06 -0700
          Re: Google Dart Released Today Swifty <steve.j.swift@gmail.com> - 2011-10-12 07:13 +0100
      closure bindings (was: Google Dart Released Today) Andreas Bergmaier <andber93@web.de> - 2011-10-11 23:56 +0200
        Re: closure bindings (was: Google Dart Released Today) David Mark <dmark.cinsoft@gmail.com> - 2011-10-11 16:20 -0700
        Re: closure bindings Bwig Zomberi <zomberiMAPSONNOSPAM@gmail.invalid> - 2011-10-12 15:02 +0530
          Re: closure bindings Antony Scriven <adscriven@gmail.com> - 2011-10-12 05:12 -0700
            Re: closure bindings dhtml <dhtmlkitchen@gmail.com> - 2011-10-12 18:27 -0700
        Re: closure bindings Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-12 13:24 +0200
          Re: closure bindings "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2011-10-12 08:56 -0700
            Re: closure bindings Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-12 21:15 +0200
              Re: closure bindings "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2011-10-12 15:21 -0700
                Re: closure bindings Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-13 20:56 +0200
                Re: closure bindings Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-13 21:36 +0200
                Re: closure bindings "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2011-10-13 16:41 -0700
                Re: closure bindings dhtml <dhtmlkitchen@gmail.com> - 2011-10-13 22:39 -0700
                Re: closure bindings "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2011-10-14 09:03 -0700
                Re: closure bindings Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-14 20:05 +0200
              Re: closure bindings dhtml <dhtmlkitchen@gmail.com> - 2011-10-12 18:38 -0700
                Re: closure bindings Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-14 23:34 +0200
                Re: closure bindings dhtml <dhtmlkitchen@gmail.com> - 2011-10-14 16:56 -0700
                Re: closure bindings Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-15 02:44 +0200
                Re: closure bindings dhtml <dhtmlkitchen@gmail.com> - 2011-10-14 21:18 -0700
            Re: closure bindings David Mark <dmark.cinsoft@gmail.com> - 2011-10-12 18:28 -0700
      Re: Google Dart Released Today Antony Scriven <adscriven@gmail.com> - 2011-10-11 15:13 -0700
        Re: Google Dart Released Today dhtml <dhtmlkitchen@gmail.com> - 2011-10-11 22:33 -0700
      Re: Google Dart Released Today Scott Sauyet <scott.sauyet@gmail.com> - 2011-10-12 07:27 -0700
        Re: Google Dart Released Today dhtml <dhtmlkitchen@gmail.com> - 2011-10-12 18:29 -0700
        Re: Google Dart Released Today Duncan Booth <duncan.booth@invalid.invalid> - 2011-10-13 08:21 +0000
          Re: Google Dart Released Today Scott Sauyet <scott.sauyet@gmail.com> - 2011-10-13 04:46 -0700
            Re: Google Dart Released Today unbewusst.sein@fai.invalid (Une Bévue) - 2011-10-13 14:03 +0200
              Re: Google Dart Released Today Duncan Booth <duncan.booth@invalid.invalid> - 2011-10-13 12:40 +0000
                Re: Google Dart Released Today unbewusst.sein@fai.invalid (Une Bévue) - 2011-10-13 17:51 +0200
            Re: Google Dart Released Today Duncan Booth <duncan.booth@invalid.invalid> - 2011-10-13 13:31 +0000
              Re: Google Dart Released Today Duncan Booth <duncan.booth@invalid.invalid> - 2011-10-13 15:17 +0000
            Re: Google Dart Released Today Karl Tikjøb Krukow <karl.krukow@gmail.com> - 2011-10-14 13:02 +0200
              Re: Google Dart Released Today dhtml <dhtmlkitchen@gmail.com> - 2011-10-14 12:36 -0700
                Re: Google Dart Released Today Karl Tikjøb Krukow <karl.krukow@gmail.com> - 2011-10-15 19:30 +0200
  Re: Google Dart Released Today David Mark <dmark.cinsoft@gmail.com> - 2011-10-10 22:23 -0700
  Re: Google Dart Released Today Matt McDonald <matt@fortybelow.ca> - 2011-10-12 19:48 -0600
    Re: Google Dart Released Today dhtml <dhtmlkitchen@gmail.com> - 2011-10-12 21:04 -0700

csiph-web