Hello Ying Xia,
Yesterday, I finally got round to making two test projects that were
identical except that one used the current GWT-OL (GWT-OL-normal) and the
other used a GWT-OL with centralized JSNI function invocation
(GWT-OL-invoke). I compiled them in detailed mode to see what the
differences would be.
Unexpectedly, quite a lot of extra javascript code is generated by GWT to
make the function invocation work. The GWT-OL-invoke was 150% the size of
GWT-OL-normal (45kb versus 30kb when obfuscated). Off course, extra code was
necessary because JSObject/JSObjectHelper contained more functionality, but
also in other classes significant amounts of extra code seems to be
generated.
I have looked a bit at other GWT libraries wrapping Javascript libraries and
in the SmartGWT library I found they also have a lot of helper methods for
doing setProperty/getProperty (setAttribute/getAttribute there), but no
helper methods for method invocation. I guess this might have a reason,
considering my findings.
Eventually, a smaller Javascript file for the user is more important than to
make it easier for us developers in my opinion. This is why I currently
think we should keep the Impl methods, so that GWT is more efficient at
generating Javascript.
Greetings,
Edwin
|