Greetings guys,
  As part of my work on reducing the output size of compiled permutations,
I've created a new polymorphic method inlining patch that changes the way
that GWT sets up methods on Javascript objects.  (see the patch here:
http://gwt-code-reviews.appspot.com/89810/show)

The old way, looks something like this:

function foo() { ... }
_.foo = foo;


That is, GWT will declare a top level function, and then assign this to a
prototype field. The patch changes this (for polymorphic methods only) to
look like this:

_.foo = function foo() { ... }


This produces a 2% size reduction (on Showcase) and preserves stack trace
information. However, for actual production code, you may wish to strip this
information to gain extra size reductions, or just build extra permutations
that contain it for debugging or A/B testing.

Changing the declaration to this:

_.foo = function() { ... }


Reduces Showcase by 6% which is a very significant gain. The problem is,
what's the best way to control this feature and turn it on and off. There
are a couple of options:

1) GWT 2.0 contains a module called EmulateJsStack which is used by GWT to
switch on stack emulation for IE browsers. It has a property called
compiler.emulatedStack which can be set to true or false. This could be
extended for a third value "strip". It seems a little strange however to
inherit a module called "EmulateJsStack" and set compiler.emulatedStack =
strip.

2) Introduce a new property: compiler.stripStack = true/false that works in
parallel. If set to true, the stack will be stripped, regardless of
EmulateJsStack settings.

3) Introduce a new property: compiler.stackMode = strip, native, emulated.
Setting this to emulated would automatically set compiler.emulatedStack to
true. Setting it to native would be the current default, and setting it to
strip would be enable the new functionality.

Other options?

-Ray

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to