back to article Dart 1.1 bullseyes JavaScript performance in latest benchmarks

Just two months after shipping the first production-ready version of Dart, its JavaScript competitor, Google has offered up a new version that it claims can output code that runs as fast or faster than the equivalent routines written in JavaScript. Dart has always been fast when running in a native VM. In fact, Dart benchmarks …

COMMENTS

This topic is closed for new posts.
  1. Anonymous Coward
    Anonymous Coward

    JS is the new ASM?

    Am I the only one being frightened by the fact that JS seems to become the new assembly of the web platform?

    Goddammit, we really need a lower level language as a common base. asm.js might be a good effort in this direction, but I'm not even sure it's enough.

    Anyway, plain old JS is way too high level for the purpose it is supposed to serve: its quirks awfully limit the amount of optimization we can squeeze out of it, and seeing how the web is evolving we're gonna need a lot more of optimization to sustain its growth, especially considering that it's supposed to kill Flash soon...

    1. rvt

      Re: JS is the new ASM?

      Ac, exacly what i am thinking. I really miss a strong typed language here. Just yesterday i was doing some simple JS and my IDE cannot even suggest proper variable or function names.

      Dart might be great for the people invented it, or for the people really using it day to day today, and be experts. But for there mere mortals it's just a other language to learn..

      1. This post has been deleted by its author

      2. GrumpyOldBloke

        Re: JS is the new ASM?

        Things are never that strongly typed anymore. Interfaces, abstract functions, virtual functions, void pointers and unions (good old days) mean that we mostly don't really care what type something is. If the purpose of type is just to keep the IDE happy so you can have intellisense or to save a few clock cycles by allowing early binding then good riddance. Once we abandon strong types then we start to free ourselves of rigid class hierarchies and refactoring and regression problems when trying to describe completely new stories.

        For example LegoBlock does not implement iFood but instances can be swallowed. Where should the new ChokingException be thrown from? It is only at run time that we find that this item does not support the EatMe method. While you could claim that this is an argument for strong types known at compile time that is not the way the new story played out. If you subsequently attempted to model this scenario you would have to refactor existing objects to implement iChewable or abandon type and pass Object references – either way it is ugly and it gets worse as new stories are created over time. Do we later need an iKissable or do we modify iChewable with a bite force or boolean sevearble attribute?

        While there are currently program and programmer management issues associated with loosely typed languages like Javascript there are also huge advantages in abandoning a rigid type system and treating objects as a blob with discoverable properties and methods – just like every living thing does in everyday life. It will change the way software is written just like OO did before it.

        1. BlueGreen

          Re: JS is the new ASM? @GrumpyOldBloke

          err, you are joking, right? Or you've never done any significant dev work in any language and most especially not a largish project in raw JS as I have, right?

        2. Roo

          Re: JS is the new ASM?

          "While there are currently program and programmer management issues associated with loosely typed languages like Javascript there are also huge advantages in abandoning a rigid type system and treating objects as a blob with discoverable properties and methods – just like every living thing does in everyday life. It will change the way software is written just like OO did before it."

          I suspect you'll find that in many cases code will revert to a pre-K&R C style crocodile infested primordial tarpit.

        3. Ken Hagan Gold badge

          Re: JS is the new ASM?

          There huge advantages in letting designers think within a looser type syste, but the best designers probably always did. Once you've decided what you want to do, there are huge advantages in using as strong a type system as you can get away with for the actual implementation, since this lets a machine check that you've actually implemented what you planned.

          But if you are content to ship an endless stream of bugs, feel free to let anything say anything it likes to anything else and have the listener use "best guess" to decide on semantics.

        4. Stephen Channell
          Pint

          Re: JS is the new ASM?

          somebody has clearly been the victim of one of those "lets use every pattern we can" Java systems designed to impress (recent) University lectures rather than customers and users... unfortunately it comes across like the reformed alcoholic looking for probation... Interfaces & stong types are not a problem, inappropriate ones are the problem.

          The IFood example is telling because it is an anti-interface (doesn't taste awful).. you could (with experience) define IFood to exclude plastics, but would have trouble with human sausages.. don't try to rationalise meaningless "interfaces", concentrate ones that describe a finite set.

          "Factorial (n) {...}" can be inferred to be numeric quite easily, but inference that a non-integer values result in infinite recursion is "tricky". What we need is optional type annotation for cases where type can not be derived from usage: e.g. "Factorial (n : integer) {}".. we'll end-up using TypeScript, regardless of whether we try Dart first

        5. Hi Wreck

          Re: JS is the new ASM?

          Don't confuse strong typing with dynamic binding. Strong typing just means all type errors are detected, which doesn't necessarily mean at compile time.

          Loose typing, while making code easy to write, is a pain in the arse for reliable programs.

          1. Anonymous Coward
            Anonymous Coward

            Re: JS is the new ASM?

            Loose typing, while making code easy to write, is a pain in the arse for reliable programs.

            I'd argue it doesn't even make it easier to write, since the tools can infer very little from the code so there's limited support for auto-completion and bugger all chance of anything but the most trivial automated refactoring. I recently spent a year of my life fighting with a loosely typed language, and it made me very glad to get back to a strongly typed one.

    2. Ken Hagan Gold badge

      Re: JS is the new ASM?

      Javascript is not the *new* assembly of the web platform. There never was any alternative. At one point in the last century the JVM might have been a contender but as soon as the Evil Sun (remember them?) decided that their bug-ridden security nightmare was the only allowed implementation anyone with any sense gave up on it. That left Javascript -- the only sufficiently commonly supported language that anyone was allowed to fix.

      Rather more successful, though only marginally less buggy and insecure, was Adobe's Flash+ActionScript combination, but here again the originating vendor's determination to prevent rival implementations meant that no-one was able to fix the bugs. Languages that are buggy by law (ie, as a direct result of the original vendor's policy) are a poor choice for third party developers.

      At one point, Microsoft tried to promote a different VM. They even went to the lengths of "not actively trying to destroy" the attempt to port it to non-Windows systems, and apparently got Canonical on-side to help promote it. That removed the buggy-by-law problem, at least if you trusted MS, but still no-one was interested. If you have a suggestion for an alternative "assembly of the web platform", I suggest you take a reality check. If MS at the height of their monopoly powers couldn't replace JS, it is unlikely that you will.

      The only thing that is "new" here is that the rest of the HTML platform is now sufficiently powerful that people are interested in writing complete apps and looking for a choice of languages to write them in.

  2. JDX Gold badge

    If you're going to compile down to JS, why not write it in a proper, widely accepted language in the first place and have that compile down to JS?

    1. Tom 7

      Why not compile the Dart environment into JS?

      Dart no longer runs on the machine I choose for development - every other language does though.

      One of the hardest things most people find in programming is debugging in a language that is not the language they wrote in. In reality this means that people will be looking at javascript to try and work out what's going wrong so it would be better to do the whole thing in javascript and at the same time try and get javascript updated to where it could have gone in the early 0's

      We seem to have gone past the point of re-inventing the wheel and are concentrating on street furniture and pothole development.

      1. David Dawson

        Re: Why not compile the Dart environment into JS?

        Check out source maps. They let you debug code that is running in JS in the original language.

  3. David Dawson

    Oracle sucks

    Google seemed to be deeply enamoured with Java and the JVM up until a couple of years ago when Oracle kicked off over android. Since then they've thrown all their development into alternate languages and runtimes, Dart, Go etc.

    A shame, if they'd improved GWT at the rate they've been improving Dart, it could've been great by now.

    1. Nathan 6

      Re: Oracle sucks

      I agree, GWT should be more of a focus for Google since I dont see Dart going anywhere soon. I have used GWT/GXT for a few projects and the speed of development is pretty good. On the other hand, Dart does seem to solve any problem that can't be solved using other approaches, and they made the fatal mistake of requiring the learning of yet another language.

    2. Anonymous Coward
      Anonymous Coward

      Re: Oracle sucks

      I suspect that if Dart takes off, then Google will simply add support so that GWT can "compile" down to that instead of JavaScript. Since they use GWT a lot for their own web applications, I have reasonably high hopes that they wont dump it. Certainly hope they carry on developing and supporting GWT, as it's definitely the best tool I've used for client side web development.

  4. Anonymous Coward
    Anonymous Coward

    javascript isn't that bad

    I honestly don't see the need to replace javascript... it's lisp in c's syntax. It's very high level and has surprising power for concise code.

    What would be nice is to allow modification of the language by flags in the script tag. For example

    <script typing="strong" cast="none">

    /// strongly typed language code, with syntax extensions

    function string getvalue( int a, int b ) {

    var int c = 1;

    // do something

    }

    </script>

    That, or just break backwards compatibility with an explicit version="" attribute. Then the language could be incrementally improved rather than tossed out and replaced with YALWNP (Yet Another Language With New Problems).

    1. Dan 55 Silver badge

      Re: javascript isn't that bad

      What you are asking for is a pragma keyword (e.g. 'pragma strict') which already exists, maybe the script tag could pass the keywords to the language if you also wanted to do it like that.

      Or maybe you're asking for the use keyword (e.g. 'use strict') which already exists too.

      So that's two ways to get strict interpretation. It seems those two strict options are different though. Perhaps what JS needs is a jesuschristjustgivemealanguagewithoutalltheevolutionarydeadends keyword.

    2. Charlie Clark Silver badge

      Re: javascript isn't that bad

      Static typing is not the same as strong typing.

  5. Charlie Clark Silver badge

    Not really for servers

    Ladd said there is growing interest in using Dart for server-side applications…

    Not sure if that's really got legs. Sure, people are bound to want to try language X on both client and server (node.js being the most prominent example) but the environments often have different and even contradictory requirements.

    Having looked briefly at Dart's syntax I've decided I'm more interested in how Go propagates from systems work to applications. Yes, I know that's a non-sequitur but Go just seems more innovative as a language and has a less antiquated syntax.

  6. Anonymous Coward
    Anonymous Coward

    but

    Do we really need endlessly more languages? How about reducing them and concentrating on better trained engineers and programmers? Just because the big, bad G wants to grab control with yet another language is not a good reason. In the real world, this is known as Babel (as in "the tower of").

    Still, I found C (K & R) to be rather good (actually, I confess to enjoying Pascal and thinking Modula 2as definitely a good idea); indeed, it seems a lot of places still do like C. I greatly appreciate, for "higher level" work, Perl, Python, even shell and awk. I actually know and like the UNIX command line and remember, fondly, when one had to know it to do anything useful (still should in my opinion). So do feel free to dismiss my opinions. You will anyway.

    It often seems to me that all that such as C++ etc. add is yet more interesting ways to write black boxes with fascinating and obscure bugs that no one has the insight or ability to detect and remove (it's such fun in C++ trying to work out why the developer changed string classes so often and still never found something efficient). As for Java - a language that purports to rescue one from careless memory allocation and deallocation and much more, but actually still leaves plenty of possibilities that are even harder to prevent or even recognise as the programmes get bigger.

    Funny thing: defect rates do not seem to have dropped and speed of fixing does seem much lower.

    And, the idea that a language is compromised to help the IDE! I do wonder if IDEs are behind much of the unnecessary growth in complexity and size as users are increasingly isolated from understanding what platform they are using (and so reinvent the wheel repeatedly) and, if the IDE can not prompt them, seem to abandon original thought or the ability to read and understand the manual. Do you really need the IDE to prompt you for names and syntax in the language you use as a professional?

    Indeed, the IDE can be harder to master than the actual language much of the time. This is not to say there is no place for a good, not over-elaborate IDE; but it is no substitute for professional, good engineering and programming by people who understand their environment and the user requirements.

    I shall stay anon. as I shall be crushed by the down-votes of those who believe progress consists of novelty rather than understanding and ability.

This topic is closed for new posts.

Other stories you might like