Dart Hello world test with optimize

JavaScript performance comparison

Revision 8 of this test case created

Info

In response to this http://jsperf.com/dart-hello-world. What if we use --optimize and run it through something which eliminates dead code?

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var e;function f(a,b){if(b>=0&&b<a.length)return b;h(aa(b))};Boolean.D=function(a){return typeof a=="boolean"||a instanceof Boolean};var i={},ba={};function ca(a,b){return function(c,d){return a.call(void 0,b,c,d)}}function j(a,b,c){return function(d,g,m){return a.call(b,c,d,g,m)}}function da(a,b,c){return function(d,g,m,p){return a.call(b,c,d,g,m,p)}}function ea(a,b){var c=fa;return function(d,g,m){return c.call(void 0,a,b,d,g,m)}}function ga(a,b){if(a.prototype.__proto__)a.prototype.__proto__=b.prototype;else{var c=function(){};c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a}}
    function k(a){if(!(typeof a=="function"?a():a))throw a=Error("Assertion failed. "),Error.captureStackTrace&&Error.captureStackTrace(a),a;}function ha(a,b){return typeof a=="number"&&typeof b=="number"?a+b:a.Pa(b)}function ia(a){a/=4;return a<0?Math.ceil(a):Math.floor(a)}function l(a,b){return a===void 0?b===void 0:typeof a=="number"&&typeof b=="number"?a==b:a.U(b)}function h(a){a&&typeof a=="object"&&Error.captureStackTrace&&Error.captureStackTrace(a);throw a;}
    function n(){var a=new o;a.f=ja();Object.g.call(a);a.Ya="";a.Sa="";a.ia=[];Object.d.call(a);h(a)}var q={a:0};function r(a){if(a===void 0)return"";if(typeof a==="number")return"n"+a;if(typeof a==="boolean")return"b"+(a?1:0);if(typeof a==="string"){var a=ka+a,b=la[a];b||(b="s"+ ++ma,la[a]=b);return b}if(typeof a==="function")throw"a function is not a constant expression";a=a.ab;if(a===void 0)throw"internal error: reference to non-canonical constant";return a}var ka=":",ma=0,la={},na={};
    function t(a,b){var c;if(a instanceof Array){c=[];for(var d=a.length-1;d>=0;d--)c.push(r(a[d]));c="a"+c.join(",")}else if(a&&a.Ma){c=oa();c.n("m");for(var d=true,g=pa(a).oa(0,q);g.aa(0,q);){var m=g.pa(0,q);d?d=false:c.n(",");c.n(r(m));c.n(",");c.n(qa(a.L(m)))}c=c.o(0,q)}else c="o"+a.t();if(b!=null){c+="<";for(d=b.length-1;d>=0;d--)c+=b[d],c+=",";c+=">"}d=ka+c;g=na[d];if(g!=null)return g;a.ab=c;return na[d]=a};var u=null,v=[],w=this,x=typeof w.importScripts!="undefined",ra=x||typeof w.Worker!="undefined",y=0,z=ra,A=false;function sa(a,b,c,d,g){if(a==y){if(a=ta.get(b))(c=a.Da.get(c))&&ua(c,a,d,g)}else(x?B:va.get(a)).postMessage({$:"message",qb:a,lb:b,mb:c,ea:d,ga:g})}function ua(a,b,c,d){wa(b,function(){var b=z||A?xa(c):c,m=z||A?xa(d):d;if(a.V!=null){var p;var C=a.V;if(C===ba)throw"circular initialization";C!==i?p=C:(a.V=ba,a.V=void 0);p(2,q,b,m)}ya()})}function za(){this.map={};this.a=0}
    function Ba(a,b,c){if(a.map[b])throw Error("Registry: Elements must be registered only once.");a.map[b]=c;a.a++}function Ca(a){var b=va;a in b.map&&(delete b.map[a],b.a--)}za.prototype.get=function(a){return this.map[a]};var va=new za,ta=new za,Da=false;x&&(Da=function(a){B.postMessage({$:"print",ea:a})});
    function Ea(a,b){var c=b.data;switch(c.$){case "start":y=c.id;var d=w[c.$a](),g=c.ga;wa(new Fa,function(){var a=z||A?xa(g):g,b=Ga(),c;0!=q.a&&n();c=Ha.prototype.Fa.call(b);if(u.w==null||u.w.J())Ia.call(a,"spawned",c);else{c={message:"spawned",ga:c};var s=t(D([],Array.h()),[""]),J;J={};if(u.w==null){var Aa=Ja();u.w=Aa}J.Ga=s.length;Aa=j(Ka,void 0,J);for(s=s.oa(0,q);s.aa(0,q);)La(s.pa(0,q),Aa);J.result=Ma();u.w.S(ca(Na,J));ya();La(J.result,j(Oa,a,c))}d.Db(b)});Pa();break;case "spawn-worker":Qa(c.$a,
    c.Jb);break;case "message":sa(c.qb,c.lb,c.mb,c.ea,c.ga);Pa();break;case "close":Ca(a.id);a.terminate();Pa();break;case "print":Ra(c.ea);break;case "error":throw c.ea;}}if(ra)w.onmessage=function(a){Ea(B,a)};var B=new function(){this.id=0};B.postMessage=function(a){w.postMessage(a)};var Sa=1;function Fa(){this.id=Sa++;this.nb={};this.nb.Ib=Math.random()*268435455>>>0;this.Da=new za;Ta(this,function(){for(var a=0,b=v.length;a<b;a++)v[a]()})}function Ta(a,b){var c=u;u=a;try{b()}finally{u=c}}var Ua=[];
    function Va(a,b){this.kb=a;this.hb=b}function wa(a,b){Ua.push(new Va(a,b))}var Wa=y+1,Xa;if(!ra||x)Xa=null;else{var Ya=document.getElementsByTagName("script"),Za=Ya[Ya.length-1],$a=Za.src;if(!$a)$a="FIXME:5407062_"+Math.random().toString(),Za.src=$a;Xa=$a}function Qa(a,b){var c=new Worker(Xa);c.onmessage=function(a){Ea(c,a)};var d=Wa++;c.id=d;Ba(va,d,c);c.postMessage({$:"start",id:d,ga:b,$a:a})}
    function Ia(a,b){if(b!==void 0&&!(b instanceof ab))throw"SendPort::send: Illegal replyTo type.";a=z||A?bb(a):cb(a);b=z||A?bb(b):cb(b);sa(this.H,this.F,this.G,a,b)}function db(){var a;Ua.length!=0?(a=Ua[0],Ua.splice(0,1)):a=void 0;return a?(Ta(a.kb,a.hb),true):(x&&ta.a===0&&B.postMessage({$:"close"}),false)}function eb(){if(typeof window!="undefined"&&window.setTimeout)(function b(){db()&&window.setTimeout(b,0)})();else for(;;)if(!db())break}
    function Pa(){if(x)try{eb()}catch(a){B.postMessage({$:"error",ea:""+a})}else eb()};Number.D=function(a){return typeof a=="number"||a instanceof Number};Object.D=function(){return true};function fb(a){Da?Da(a):this.console?this.console.log(a):this.write&&(this.write(a),this.write("\n"))};function E(a,b,c){this.c=a;this.pb=b?b:a;this.i=c;this.b={};this.b[a]=this;a!=F("Object")&&(this.b[F("Object")]=G)}var gb={};E.prototype.q=[];E.prototype.toString=function(){return this.pb};E.prototype.ya=function(a){return a==null?this===G||this===H:this.ca(hb(a))};function ib(a,b){return a.hasOwnProperty(b)?a[b]:null}
    E.prototype.ca=function(a){if(a===this||a===H)return true;a=ib(a.b,this.c);if(a==null)return false;if(a.i&&this.i)for(var b=this.i.length-1;b>=0;b--)if(!this.i[b].ca(a.i[b]))return false;return true};function jb(a){if(a instanceof Array)return Array.h();switch(typeof a){case "string":return String.h();case "number":return Number.h();case "boolean":return Boolean.h()}return kb}
    function I(a,b,c){if(a==F("Object"))return G;var d=lb(a,c),g=ib(gb,d);if(g)return g;a=lb(a);g=new E(a,d,c);gb[d]=g;b&&b(g,c);return g}function lb(a,b){var c=a;b&&(c+="<"+b.join(",")+">");return c}function hb(a){return a.f?a.f:jb(a)}function D(a,b){a.f=b;return a}function K(a,b){if(a)if(a.length>b)return a[b];else throw Error("Missing type arg");return H}function L(a,b){var c=ib(hb(a).b,b);if(!c)throw Error("internal error: can not find "+b+" in "+JSON.stringify(a));return c.i}var G=new E(F("Object"));
    G.ya=function(){return true};G.ca=function(){return true};var H=new E(F("Dynamic"));H.ya=function(){return true};H.ca=function(){return true};var kb=new E(F("::"));kb.ya=function(){return true};kb.ca=function(){return true};D(Function.prototype,I(F("Function$Dart")));function F(a){return"cls:"+a};String.D=function(a){return typeof a=="string"||a instanceof String};function mb(a){if(!(a instanceof Array)){for(var b=a.length,c=Array(b),d=0;d<b;d++)c[d]=a.L(d);a=c}return String.fromCharCode.apply(this,a)};function M(a,b){var c=true;b==null?(b=0,c=false):b<0&&h(nb(b));var d;d=ob(pb([K(a,0)]));d=D(Array(b),Array.h(hb(d).i));d.X=c;return d};Array.h=function(a){return I(F("Array"),Array.C,a)};Array.C=function(a,b){Array.v(a,b);a.q=[]};Array.v=function(a,b){var c=Array.h(b);a.b[c.c]=c;qb(a,[K(a.i,0)])};e=Array.prototype;e.La=1;e.L=function(a){if(0<=a&&a<this.length)return this.sa(a);h(aa(a))};e.T=function(a,b){(a<0||this.length<=a)&&h(aa(a));this[a]=b};
    e.za=function(){var a;if(this.X){a=rb([K(L(this,F("Array")),0)]);var b=new N;b.f=a;Object.g.call(b);b.M=this;b.R=0;b.P=this.length}else a=sb([K(L(this,F("Array")),0)]),b=new O,b.f=a,Object.g.call(b),b.M=this,b.R=0;Object.d.call(b);return a=b};e.oa=function(a,b){(0!=b.a||0+a!=0)&&n();return Array.prototype.za.call(this)};e.sa=function(a){return this[a]};e.da=function(){return this.length};e.s=function(a){for(var b=this.oa(0,q);b.aa(0,q);){var c=b.pa(0,q);a(1,q,c)}};
    e.wa=function(a,b,c){(0!=b.a||0+a!=1)&&n();return Array.prototype.s.call(this,c)};e.J=function(){return this.length===0};e.n=function(a){this.X?h(t(tb("Cannot add to a non-extendable array"))):this.push(a)};e.S=function(a){this.n(a)};e.Z=function(){this.X?h(t(tb("Cannot clear a non-extendable array"))):this.X?h(t(tb("Cannot change the length of a non-extendable array"))):this.length=0};Array.d=function(){Object.d.call(this)};Array.g=function(){Object.g.call(this)};
    Array.Ab=function(a){var b=[];b.f=a;Array.g.call(b);Array.d.call(b);return b};function N(a,b,c){this.M=a;this.R=b;this.P=c}function rb(a){return I(F("FixedSizeArrayIterator$Dart"),ub,a)}function ub(a,b){var c=rb(b);a.b[c.c]=c;vb(a,[K(a.i,0)]);a.q=[]}ga(N,O);N.prototype.I=function(){return this.P>this.R};N.prototype.aa=function(a,b){(0!=b.a||0+a!=0)&&n();return N.prototype.I.call(this)};function O(a,b){this.M=a;this.R=b}function sb(a){return I(F("VariableSizeArrayIterator$Dart"),wb,a)}function wb(a,b){vb(a,b);a.q=[]}function vb(a,b){var c=sb(b);a.b[c.c]=c;xb(a,[K(a.i,0)])}O.prototype.I=function(){return this.M.length>this.R};O.prototype.aa=function(a,b){(0!=b.a||0+a!=0)&&n();return O.prototype.I.call(this)};O.prototype.Ba=function(){this.I()||h(t(yb()));return this.M[f(this.M,this.R++)]};O.prototype.pa=function(a,b){(0!=b.a||0+a!=0)&&n();return O.prototype.Ba.call(this)};Boolean.h=function(){return I(F("Boolean"),Boolean.C)};Boolean.C=function(a){Boolean.v(a)};Boolean.v=function(a){var b=Boolean.h();a.b[b.c]=b;b=I(F("bool$Dart"));a.b[b.c]=b};Boolean.prototype.U=function(a){return typeof a=="boolean"?this==a:a instanceof Boolean?this==Boolean(a):false};Boolean.prototype.j=function(){return this==true?"true":"false"};Boolean.prototype.o=function(a,b){(0!=b.a||0+a!=0)&&n();return Boolean.prototype.j.call(this)};Boolean.d=function(){Object.d.call(this)};Boolean.g=function(){Object.g.call(this)};
    Boolean.sb=function(){var a=new Boolean;a.f=Boolean.h();Boolean.g.call(a);Boolean.d.call(a);return a};function qa(a){return r(a)};function ab(){}function zb(a){var b=I(F("SendPortImpl$Dart"),zb);a.b[b.c]=b;Ab(a)}e=ab.prototype;e.Na=1;function P(a,b,c){var d=new ab;d.f=I(F("SendPortImpl$Dart"),zb);Object.g.call(d);d.H=a;d.F=b;d.G=c;Object.d.call(d);return d}function Oa(a,b,c){(0!=c.a||0+b!=1)&&n();Ia.call(this,a.message,a.ga)}e.U=function(a){return!!(a!=null&&a.Na)&&l(this.H,a.H)&&l(this.F,a.F)&&l(this.G,a.G)};e.ba=function(){return this.H<<16^this.F<<8^this.G};e.na=function(a,b){(0!=b.a||0+a!=0)&&n();return ab.prototype.ba.call(this)};
    e.t=function(){return F("SendPortImpl$Dart")+(":"+r(this.G))+(":"+r(this.F))+(":"+r(this.H))};var Bb;function Ha(a,b){this.la=a;this.V=b}function Cb(){return I(F("ReceivePortImpl$Dart"),Db)}function Db(a){var b=Cb();a.b[b.c]=b;b=I(F("ReceivePort$Dart"));a.b[b.c]=b}Ha.prototype.bb=1;function Ga(){Bb=u.Qa;var a=ha(Bb,1);u.Qa=a;a=new Ha(Bb,void 0);Object.d.call(this);a.f=Cb();Object.d.call(a);var b=a.la,c=u;c.Da.a===0&&Ba(ta,c.id,c);Ba(c.Da,b,a);return a}Ha.prototype.Fa=function(){return P(y,u.id,this.la)};function cb(a){var b=new Eb;b.f=I(F("Copier$Dart"),Fb);Object.g.call(b);Object.d.call(b);return Gb(b,a)}function bb(a){var b=new Hb;b.f=I(F("Serializer$Dart"),Ib);Object.g.call(b);b.ma=0;Object.d.call(b);return Gb(b,a)}function xa(a){var b=Jb();0!=q.a&&n();return Kb.prototype.gb.call(b,a)};function Lb(a){this.B=a}function Mb(a){var b=I(F("MessageTraverser$Dart"));a.b[b.c]=b}function Nb(a){return a==null||String.D(a)||!!(a!=null&&a.Oa)||Boolean.D(a)}e=Lb.prototype;e.ob=function(a){if(Nb(a))return this.qa(a);this.B=M(null,void 0);var b=void 0;try{b=Q(this,a)}finally{for(var a=this.B.length,c=0;c<a;c++)this.B[f(this.B,c)].__MessageTraverser__attached_info__=void 0;this.B=void 0}return b};function Gb(a,b){0!=q.a&&n();return Lb.prototype.ob.call(a,b)}
    function Ob(a,b,c){a.B.n(b);b.__MessageTraverser__attached_info__=c}function Q(a,b){if(Nb(b))return a.qa(b);if(b!=null&&b.La)return a.Ha(b);if(b!=null&&b.Ma)return a.Ia(b);if(b!=null&&b.Na)return a.ha(b);if(b!=null&&b.bb)return a.Ja(b);if(b!=null&&b.rb)return a.Ka(b);h("Message serialization: Illegal value "+R(b)+" passed")}e.qa=function(){};e.Ha=function(){};e.Ia=function(){};e.ha=function(){};e.Ja=function(){};e.Ka=function(){};function Pb(a){return a.__MessageTraverser__attached_info__};function Eb(a){this.B=a}function Fb(a){var b=I(F("Copier$Dart"),Fb);a.b[b.c]=b;Mb(a)}ga(Eb,Lb);e=Eb.prototype;e.qa=function(a){return a};e.Ha=function(a){var b=Pb(a);if(b!=null)return b;var c=a.length,b=M(null,c);Ob(this,a,b);for(var d=0;d<c;d++)b[f(b,d)]=Q(this,a[f(a,d)]);return b};function Qb(a,b,c,d,g){(0!=c.a||0+b!=2)&&n();a.copy.T(Q(this,d),Q(this,g))}e.Ia=function(a){var b;b={};b.copy=Pb(a);if(b.copy!=null)return b.copy;b.copy=Rb();Ob(this,a,b.copy);a.wa(1,q,da(Qb,this,b));return b.copy};
    e.ha=function(a){return P(a.H,a.F,a.G)};e.Ja=function(a){return P(y,u.id,a.la)};e.Ka=function(a){return P(y,u.id,a.la)};function Hb(a,b){this.B=a;this.ma=b}function Ib(a){var b=I(F("Serializer$Dart"),Ib);a.b[b.c]=b;Mb(a)}ga(Hb,Lb);e=Hb.prototype;e.qa=function(a){return a};e.Ha=function(a){var b=Pb(a);if(b!=null)return S(D(["ref",b],Array.h()));b=this.ma++;Ob(this,a,b);a=Sb(this,a);return S(D(["list",b,a],Array.h()))};e.Ia=function(a){var b=Pb(a);if(b!=null)return S(D(["ref",b],Array.h()));b=this.ma++;Ob(this,a,b);var c=Sb(this,pa(a));0!=q.a&&n();a=T.prototype.jb.call(a);a=Sb(this,a);return S(D(["map",b,c,a],Array.h()))};
    e.ha=function(a){return S(D(["sendport",a.H,a.F,a.G],Array.h()))};e.Ja=function(a){return this.ha(a.Fa())};e.Ka=function(a){return this.ha(a.Fa())};function Sb(a,b){for(var c=b.length,d=Array(c),g=0;g<c;g++){var m=Q(a,b[f(b,g)]);d[g]=m}return d}function S(a){if(a instanceof Array)a.f=null;else{for(var b=a.length,c=Array(b),d=0;d<b;d++)c[d]=a.L(d);a=c}return a};function Kb(a){this.ka=a}function Jb(){var a=new Kb(void 0);Object.d.call(this);a.f=I(F("Deserializer$Dart"));Object.d.call(a);return a}function Tb(a){return a==null||String.D(a)||!!(a!=null&&a.Oa)||Boolean.D(a)}Kb.prototype.gb=function(a){if(Tb(a))return a;this.ka=Rb();return Ub(this,a)};
    function Ub(a,b){if(Tb(b))return b;k(b instanceof Array);switch(b[0]){case "ref":var c=a.ka.L(b[1]);k(c!=null);return c;case "list":var d=b[1],c=b[2];k(c instanceof Array);k(!!(c!=null&&c.La));a.ka.T(d,c);for(var d=c.length,g=0;g<d;g++)c[f(c,g)]=Ub(a,c[f(c,g)]);return c;case "map":c=Rb();a.ka.T(b[1],c);d=b[2];g=b[3];k(d instanceof Array);k(g instanceof Array);var m=d.length;k(m===g.length);for(var p=0;p<m;p++){var C=Ub(a,d[p]),s=Ub(a,g[p]);c.T(C,s)}return c;case "sendport":return P(b[1],b[2],b[3]);
    default:h("Unexpected serialized object")}};Number.h=function(){return I(F("Number"),Number.C)};Number.C=function(a){Number.v(a)};Number.v=function(a){var b=Number.h();a.b[b.c]=b;Vb(a);Wb(a)};e=Number.prototype;e.Oa=1;e.Pa=function(a){return this+a};e.U=function(a){return typeof a=="number"?this==a:a instanceof Number?this==Number(a):false};e.j=function(){return this.toString()};e.o=function(a,b){(0!=b.a||0+a!=0)&&n();return Number.prototype.j.call(this)};e.ba=function(){return this&268435455};e.na=function(a,b){(0!=b.a||0+a!=0)&&n();return Number.prototype.ba.call(this)};
    Number.d=function(){Object.d.call(this)};Number.g=function(){Object.g.call(this)};Number.zb=function(){var a=new Number;a.f=Number.h();Number.g.call(a);Number.d.call(a);return a};String.h=function(){return I(F("String"),String.C)};String.C=function(a){String.v(a)};String.v=function(a){var b=String.h();a.b[b.c]=b;Xb(a)};String.Bb=function(a){return String.Xa(a)};e=String.prototype;e.L=function(a){if(0<=a&&a<this.length)return this.sa(a);h(aa(a))};e.da=function(){return this.length};e.U=function(a){return typeof a=="string"?this==a:a instanceof String?this==String(a):false};e.J=function(){return this.length===0};e.Pa=function(a){return this.concat(a.o(0,q))};
    e.ba=function(){if(this.r===void 0){for(var a=0;a<this.length;a++)this.r+=this.charCodeAt(a),this.r+=this.r<<10,this.r^=this.r>>6;this.r+=this.r<<3;this.r^=this.r>>11;this.r+=this.r<<15;this.r&=536870911}return this.r};e.na=function(a,b){(0!=b.a||0+a!=0)&&n();return String.prototype.ba.call(this)};e.j=function(){return String(this)};e.o=function(a,b){(0!=b.a||0+a!=0)&&n();return String.prototype.j.call(this)};String.Xa=function(a){return mb(a)};String.eb=function(a,b,c){(0!=b.a||0+a!=1)&&n();return String.Xa(c)};
    String.Cb=function(){return String.eb};String.prototype.sa=function(a){return this[a]};function R(a){return a==null?"null":a.o(0,q)};function Yb(){}function Zb(){return I(F("StringBufferImpl$Dart"),$b)}function $b(a){var b=Zb();a.b[b.c]=b;b=I(F("StringBuffer$Dart"));a.b[b.c]=b}function oa(){var a=new Yb;a.f=Zb();Object.g.call(a);Object.d.call(a);a.Z();a.n("");return a}e=Yb.prototype;e.da=function(){return this.P};e.J=function(){return this.P===0};e.n=function(a){a=a.o(0,q);if(a==null||a.J())return this;this.z.n(a);this.P+=a.da();return this};
    e.Z=function(){var a=[I(F("String$Dart"),ac)],b=void 0,c=true;b==null?(b=0,c=false):b<0&&h(nb(b));a=ob(pb([K(a,0)]));b=D(Array(b),Array.h(hb(a).i));b.X=c;this.z=b;this.P=0;return this};e.j=function(){if(this.z.length===0)return"";if(this.z.length===1)return this.z[f(this.z,0)];var a;a=this.z;for(var b="",c=0;c<a.length;c++){c>0&&(b=b.concat(""));var d=a[f(a,c)],b=b.concat(d)}a=b;this.z.Z();this.z.n(a);return a};e.o=function(a,b){(0!=b.a||0+a!=0)&&n();return Yb.prototype.j.call(this)};function bc(){}function pb(a){return I(F("TypeToken$Dart"),null,a)}function ob(a){var b=new bc;b.f=a;Object.g.call(b);Object.d.call(b);return b}bc.prototype.t=function(){return F("TypeToken$Dart")};function cc(a,b){qb(a,b);a.q=[]}function qb(a,b){var c=I(F("Array$Dart"),cc,b);a.b[c.c]=c;dc(a,[K(a.i,0)])};function T(){}function ec(a){return I(F("HashMapImplementation$Dart"),fc,a)}function fc(a,b){var c=ec(b);a.b[c.c]=c;gc(a,[K(a.i,0),K(a.i,1)]);a.q=[]}e=T.prototype;e.Ma=1;function Rb(){var a=ec(),b=new T;b.f=a;Object.g.call(b);Object.d.call(b);if(u.K==null)a=Object.cb(),u.K=a;b.A=0;b.Y=0;a=ia(24);b.Va=a;b.e=M(null,8);b.k=M([K(L(b,F("HashMapImplementation$Dart")),1)],8);return b}
    function hc(a,b){var c;c=b.na(0,q)&a.e.length-1;for(var d=1,g=-1;;){var m=a.e[f(a.e,c)];if(m==null)return g<0?c:g;else if(l(m,b))return c;else g<0&&u.K===m&&(g=c);m=d++;c=c+m&a.e.length-1}}function ic(a,b){var c;c=b.na(0,q)&a.e.length-1;for(var d=1;;){var g=a.e[f(a.e,c)];if(g==null)return-1;if(l(g,b))return c;g=d++;c=c+g&a.e.length-1}}
    function jc(a,b){k((b&b-1)===0);var c=a.e.length;a.Va=ia(b*3);var d=a.e,g=a.k;a.e=M(null,b);a.k=M([K(L(a,F("HashMapImplementation$Dart")),1)],b);for(var m=0;m<c;m++){var p=d[f(d,m)];if(!(p==null||p===u.K)){var C=g[f(g,m)],s=hc(a,p);a.e[f(a.e,s)]=p;a.k[f(a.k,s)]=C}}a.Y=0}e.Z=function(){this.Y=this.A=0;for(var a=this.e.length,b=0;b<a;b++)this.e[f(this.e,b)]=void 0,this.k[f(this.k,b)]=void 0};
    e.T=function(a,b){var c=this.A+1;c>=this.Va?jc(this,this.e.length*2):this.Y>this.e.length-c-this.Y&&jc(this,this.e.length);c=hc(this,a);(this.e[f(this.e,c)]==null||this.e[f(this.e,c)]===u.K)&&this.A++;this.e[f(this.e,c)]=a;this.k[f(this.k,c)]=b};e.L=function(a){a=ic(this,a);return a<0?void 0:this.k[f(this.k,a)]};e.fa=function(a){a=ic(this,a);if(a>=0){this.A--;var b=this.k[f(this.k,a)];this.k[f(this.k,a)]=void 0;this.e[f(this.e,a)]=u.K;this.Y++;return b}};
    e.Ea=function(a,b,c){(0!=b.a||0+a!=1)&&n();return T.prototype.fa.call(this,c)};e.J=function(){return this.A===0};e.da=function(){return this.A};e.s=function(a){for(var b=this.e.length,c=0;c<b;c++)this.e[f(this.e,c)]!=null&&this.e[f(this.e,c)]!==u.K&&a(2,q,this.e[f(this.e,c)],this.k[f(this.k,c)])};e.wa=function(a,b,c){(0!=b.a||0+a!=1)&&n();return T.prototype.s.call(this,c)};function kc(a,b,c,d){(0!=c.a||0+b!=2)&&n();a.list[f(a.list,a.xa++)]=d}
    e.ib=function(){var a;a={};a.list=M([K(L(this,F("HashMapImplementation$Dart")),0)],this.A);a.xa=0;this.s(da(kc,void 0,a));return a.list};function pa(a){0!=q.a&&n();return T.prototype.ib.call(a)}function lc(a,b,c,d,g){(0!=c.a||0+b!=2)&&n();a.list[f(a.list,a.xa++)]=g}e.jb=function(){var a;a={};a.list=M([K(L(this,F("HashMapImplementation$Dart")),1)],this.A);a.xa=0;this.s(da(lc,void 0,a));return a.list};function mc(){}function nc(a,b){var c=I(F("PromiseImpl$Dart"),nc,b);a.b[c.c]=c;c=[K(a.i,0)];c=I(F("Promise$Dart"),null,c);a.b[c.c]=c;a.q=[]}function Ma(){var a=I(F("PromiseImpl$Dart"),nc,void 0),b=new mc;b.f=a;Object.g.call(b);b.p=0;b.ta=void 0;b.ra=void 0;b.Q=void 0;b.O=void 0;b.ja=void 0;Object.d.call(b);return b}function U(a){return a.p!==0&&a.p!==1}function oc(a,b,c,d){(0!=c.a||0+b!=1)&&n();d(1,q,a.Aa)}
    function pc(a,b){var c={Aa:b};a.p===4?(a.ta=c.Aa,a.p=5):(U(a)&&h("Attempted to complete an already completed promise."),a.ta=c.Aa,a.p=2,a.Q!=null&&a.Q.s(j(oc,void 0,c)),qc(a))}function qc(a){a.Q=void 0;a.O=void 0;a.ja=void 0}function rc(a,b,c,d){(0!=c.a||0+b!=1)&&n();d(1,q,a.va)}function sc(a,b){var c={va:b};a.p===4?(a.ra=c.va,a.p=6):(U(a)&&h("Can't fail an already completed promise."),a.ra=c.va,a.p=3,a.O!=null&&a.O.s(j(rc,void 0,c)),qc(a))}
    function fa(a,b,c,d,g){(0!=d.a||0+c!=1)&&n();pc(b.Ca,a.fb(1,q,g))}function tc(a,b,c,d){(0!=c.a||0+b!=1)&&n();sc(a.Ca,d)}function uc(a,b,c){(0!=c.a||0+b!=0)&&n();sc(a.Ca,"Source promise was cancelled")}
    function La(a,b){var c={fb:b},d;d={};d.Ca=Ma();c=ea(c,d);if(a.p===2)c(1,q,a.ta);else if(!U(a)){if(a.Q==null)a.Q=Ja();a.Q.S(c)}c=j(tc,void 0,d);if(a.p===3)c(1,q,a.ra);else if(!U(a)){if(a.O==null)a.O=Ja();a.O.S(c)}d=ca(uc,d);if(a.p===4||a.p===5||a.p===6)d(0,q);else if(!U(a)){if(a.ja==null)a.ja=Ja();a.ja.S(d)}};function Ka(a,b,c){(0!=c.a||0+b!=1)&&n();k(a.Ga>0);a.Ga--}function Na(a,b,c){(0!=c.a||0+b!=0)&&n();a.Ga>0?a=false:(pc(a.result,void 0),a=true);return a}function ya(){if(u.w!=null)for(;!u.w.J()&&u.w.m.l.ua()(0,q);)u.w.m.l.Ea(0,q)};function V(a,b,c){this.u=a;this.l=b;this.N=c}function vc(a){return I(F("DoubleLinkedQueueEntry$Dart"),null,a)}V.prototype.Ua=function(a,b){this.l=b;this.u=a;a.l=this;b.u=this};V.prototype.fa=function(){this.u.l=this.l;this.l.u=this.u;this.u=this.l=void 0;return this.N};V.prototype.Ea=function(a,b){(0!=b.a||0+a!=0)&&n();return V.prototype.fa.call(this)};V.prototype.ua=function(){return this.N};function W(a,b,c){this.u=a;this.l=b;this.N=c}function wc(a){return I(F("_DoubleLinkedQueueEntrySentinel$Dart"),xc,a)}function xc(a,b){var c=wc(b);a.b[c.c]=c;c=[K(a.i,0)];c=vc(c);a.b[c.c]=c;a.q=[]}ga(W,V);W.prototype.fa=function(){h(t(yc()))};W.prototype.Ea=function(a,b){(0!=b.a||0+a!=0)&&n();return W.prototype.fa.call(this)};W.prototype.ua=function(){h(t(yc()))};function zc(){}function Ac(a){return I(F("DoubleLinkedQueue$Dart"),Bc,a)}function Bc(a,b){var c=Ac(b);a.b[c.c]=c;Cc(a,[K(a.i,0)]);a.q=[]}function Ja(){var a=Ac([I(F("Function$Dart"))]),b=new zc;b.f=a;Object.g.call(b);Object.d.call(b);var a=wc([K(L(b,F("DoubleLinkedQueue$Dart")),0)]),c=new W;c.f=a;Object.g.call(c);Object.d.call(c);c.N=void 0;c.Ua(c,c);b.m=c;return b}e=zc.prototype;
    e.S=function(a){var b=this.m,c=vc([K(L(b,F("DoubleLinkedQueueEntry$Dart")),0)]),d=new V;d.f=c;Object.g.call(d);Object.d.call(d);d.N=a;a=b.u;0!=q.a&&n();V.prototype.Ua.call(d,a,b)};e.n=function(a){this.S(a)};function Dc(a,b,c){(0!=c.a||0+b!=1)&&n();a.Za++}e.da=function(){var a;a={Za:0};this.s(j(Dc,void 0,a));return a.Za};e.J=function(){return this.m.l===this.m};e.Z=function(){this.m.l=this.m;this.m.u=this.m};e.s=function(a){for(var b=this.m.l;b!==this.m;)a(1,q,b.N),b=b.l};
    e.wa=function(a,b,c){(0!=b.a||0+a!=1)&&n();return zc.prototype.s.call(this,c)};e.za=function(){return Ec(Fc([K(L(this,F("DoubleLinkedQueue$Dart")),0)]),this.m)};e.oa=function(a,b){(0!=b.a||0+a!=0)&&n();return zc.prototype.za.call(this)};function X(a,b){this.m=a;this.W=b}function Fc(a){return I(F("_DoubleLinkedQueueIterator$Dart"),Gc,a)}function Gc(a,b){var c=Fc(b);a.b[c.c]=c;xb(a,[K(a.i,0)]);a.q=[]}function Ec(a,b){var c=new X(b,void 0);Object.d.call(this);c.f=a;Object.d.call(c);c.W=c.m;return c}X.prototype.I=function(){return this.W.l!==this.m};X.prototype.aa=function(a,b){(0!=b.a||0+a!=0)&&n();return X.prototype.I.call(this)};X.prototype.Ba=function(){this.I()||h(t(yb()));this.W=this.W.l;return this.W.ua()};
    X.prototype.pa=function(a,b){(0!=b.a||0+a!=0)&&n();return X.prototype.Ba.call(this)};Object.h=function(){return I(F("Object"))};Object.v=function(a){var b=Object.h();a.b[b.c]=b};Object.d=function(){};Object.g=function(){};Object.cb=function(){var a={};a.f=Object.h();Object.d.call(a);return a};Object.prototype.U=function(a){return this===a};Object.prototype.j=function(){return"Object"};Object.prototype.o=function(a,b){(0!=b.a||0+a!=0)&&n();return Object.prototype.j.call(this)};Object.prototype.t=function(){return F("Object")+(":"+r(this.Hb))};function Ra(a){0!=q.a&&n();a=a==null?"null":a.o(0,q);fb(a)};function Hc(a,b){Ic(a,b);a.q=[]}function Ic(a,b){var c=I(F("Collection$Dart"),Hc,b);a.b[c.c]=c;c=[K(a.i,0)];c=I(F("Iterable$Dart"),null,c);a.b[c.c]=c};function Jc(a){Wb(a)}function Wb(a){var b=I(F("double$Dart"),Jc);a.b[b.c]=b;Kc(a)};function Y(a){var b=I(F("Exception$Dart"));a.b[b.c]=b};function Z(){}function Lc(){return I(F("IndexOutOfRangeException$Dart"),Mc)}function Mc(a){var b=Lc();a.b[b.c]=b;Y(a)}function aa(a){var b=new Z;b.f=Lc();Object.g.call(b);b.Ta=a;Object.d.call(b);return b}Z.prototype.j=function(){return"IndexOutOfRangeException: "+R(this.Ta)+""};Z.prototype.o=function(a,b){(0!=b.a||0+a!=0)&&n();return Z.prototype.j.call(this)};Z.prototype.t=function(){return F("IndexOutOfRangeException$Dart")+(":"+r(this.Ta))};function o(){}function ja(){return I(F("NoSuchMethodException$Dart"),Nc)}function Nc(a){var b=ja();a.b[b.c]=b;Y(a)}o.prototype.j=function(){for(var a=oa(),b=0;b<this.ia.length;b++)b>0&&a.n(", "),a.n(this.ia[f(this.ia,b)]);a.n("]");return ha("NoSuchMethodException - receiver: '"+R(this.Ya)+"' ","function name: '"+R(this.Sa)+"' arguments: ["+R(a)+"]")};o.prototype.o=function(a,b){(0!=b.a||0+a!=0)&&n();return o.prototype.j.call(this)};
    o.prototype.t=function(){return F("NoSuchMethodException$Dart")+(":"+r(this.Ya))+(":"+r(this.Sa))+(":"+r(this.ia))};function $(){}function Oc(){return I(F("IllegalArgumentException$Dart"),Pc)}function Pc(a){var b=Oc();a.b[b.c]=b;Y(a)}function nb(a){var b=new $;b.f=Oc();Object.g.call(b);b.Ra=a;Object.d.call(b);return b}$.prototype.j=function(){return"Illegal argument(s): "+R(this.Ra)+""};$.prototype.o=function(a,b){(0!=b.a||0+a!=0)&&n();return $.prototype.j.call(this)};$.prototype.t=function(){return F("IllegalArgumentException$Dart")+(":"+r(this.Ra))};function Qc(){}function Rc(){return I(F("NoMoreElementsException$Dart"),Sc)}function Sc(a){var b=Rc();a.b[b.c]=b;Y(a)}function yb(){var a=new Qc;a.f=Rc();Object.g.call(a);Object.d.call(a);return a}Qc.prototype.j=function(){return"NoMoreElementsException"};Qc.prototype.o=function(a,b){(0!=b.a||0+a!=0)&&n();return Qc.prototype.j.call(this)};Qc.prototype.t=function(){return F("NoMoreElementsException$Dart")};function Tc(){}function Uc(){return I(F("EmptyQueueException$Dart"),Vc)}function Vc(a){var b=Uc();a.b[b.c]=b;Y(a)}function yc(){var a=new Tc;a.f=Uc();Object.g.call(a);Object.d.call(a);return a}Tc.prototype.j=function(){return"EmptyQueueException"};Tc.prototype.o=function(a,b){(0!=b.a||0+a!=0)&&n();return Tc.prototype.j.call(this)};Tc.prototype.t=function(){return F("EmptyQueueException$Dart")};function Wc(){}function Xc(){return I(F("UnsupportedOperationException$Dart"),Yc)}function Yc(a){var b=Xc();a.b[b.c]=b;Y(a)}function tb(a){var b=new Wc;b.f=Xc();Object.g.call(b);b.Wa=a;Object.d.call(b);return b}Wc.prototype.j=function(){return"UnsupportedOperationException: "+R(this.Wa)+""};Wc.prototype.o=function(a,b){(0!=b.a||0+a!=0)&&n();return Wc.prototype.j.call(this)};Wc.prototype.t=function(){return F("UnsupportedOperationException$Dart")+(":"+r(this.Wa))};function Zc(a){var b=I(F("Hashable$Dart"));a.b[b.c]=b};function $c(a){Vb(a)}function Vb(a){var b=I(F("int$Dart"),$c);a.b[b.c]=b;Kc(a)};function ad(a){Ab(a)}function Ab(a){var b=I(F("SendPort$Dart"),ad);a.b[b.c]=b;Zc(a)};function xb(a,b){var c=I(F("Iterator$Dart"),null,b);a.b[c.c]=c};function bd(a,b){dc(a,b);a.q=[]}function dc(a,b){var c=I(F("List$Dart"),bd,b);a.b[c.c]=c;Ic(a,[K(a.i,0)])};function cd(a,b){gc(a,b);a.q=[]}function gc(a,b){var c=I(F("HashMap$Dart"),cd,b);a.b[c.c]=c;c=[K(a.i,0),K(a.i,1)];c=I(F("Map$Dart"),null,c);a.b[c.c]=c};function dd(a){Kc(a)}function Kc(a){var b=I(F("num$Dart"),dd);a.b[b.c]=b;b=I(F("Comparable$Dart"));a.b[b.c]=b;Zc(a)};function ed(a,b){Cc(a,b);a.q=[]}function Cc(a,b){var c=I(F("Queue$Dart"),ed,b);a.b[c.c]=c;Ic(a,[K(a.i,0)])};function ac(a){Xb(a)}function Xb(a){var b=I(F("String$Dart"),ac);a.b[b.c]=b;b=I(F("Comparable$Dart"));a.b[b.c]=b;Zc(a);b=I(F("Pattern$Dart"));a.b[b.c]=b};v.push(function(){this.V=i;u.Qa=1});v.push(function(){this.ma=0});v.push(function(){u.Fb=i;u.Eb=i;u.Gb=i});v.push(function(){u.vb=i;u.ub=i;u.tb=i;u.yb=i;u.xb=i;u.wb=i});
};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
As is JS
function HelloDartTest() {}
HelloDartTest.prototype.testMain = function() {
  console.log("Hello JavaScripter!");
};
(new HelloDartTest).testMain();
pending…
JS (from Dart) with --optimize
(function(a){
  if(!x){
    var c=new Fa;
    wa(c,function(){a()});
    Pa();
    u=c
      }
})(function(){Ra("Hello, Darter!")});
 
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment