I finally got my app to compile a release version by eliminating my circular
dependencies. So far so good.
FYI, I fixed this by doing two things: 1. I added a className property and
instead of doing if(this is Sub), I’m using if(this.className == “Sub”). 2. I
enabled -js-output-optimization=skipAsCoercions (two of my circulars were due
to an “as” statement which caused a circular dependency chain through a number
of different classes).
I have some observations / problems with the optimizations for the release
build:
1. It’s optimized to the point where it does not work. If I run MyApp.start()
in index.html, I get an error that MyApp is not defined. Looking in the JS, I
see that Em=‘MyApp’. Is there something special I need to do to prevent this
from happening?
2. Prototype definitions are not being optimized as much as they could. The
pattern is MyClass.prototype.foo = “some value”; for each one. If that’s
replaced with MyClass.prototype = {foo:”somevalue”,…} It’ll save
“MyClass.prototype” getting written for every property.
3. Static constants are not being optimized as much as they should. I’m not
sure what’s responsible for this, but instead of literals or compact variables,
it’s using the fully qualified static name every time.
4. Full class paths are not needed. The class paths could easily be shortened
to a few unique characters for significant optimization. I just tried a search
and replace on a 900KB file, and just replacing the package paths reduced the
file size by 20KB.
There’s other optimizations which could probably be taken advantage of, but
that’s my list for now.
Harbs