4 ms·
Good point, Dart2js isn't the only compiler that can apply optimizations. I believe Closure Compiler also performs optimizations. Both GWT and Closure have been
by sethladd 14y ago
Good point, Dart2js isn't the only compiler that can apply optimizations. I believe Closure Compiler also performs optimizations. Both GWT and Closure have been out for years, to be fair. :)
[disclaimer: I work on the Dart team]
- cromwellian 14y agoWe do some global inferencing in GWT, but we don't do range check elimination. There was a 20% contributor who added it at one point, but it never landed. We tighten types by looking at flow into and out of methods globally and locally (e.g. if you method says it return Object, but you return new Foo(), we consider the method as actually returning Foo). We also do nullability analysis, so for example, we can short circuit an if(x instanceof Foo) if x is known to be null, or Foo is a null type (never instantiated anywhere)