GWT uses a pay-as-you-go design philosophy, and since you are not allowed to use reflection, the compiler can statically prove (by method) that a section of code is βavailableβ and eliminate those that donβt. For example, if you never use the remove () method in ArrayList, then this code will not be included in the resulting JavaScript.
If you see a few kilobyte jumps with just a few lines added, this probably means that you have introduced the use of a new type (and possibly another that depends on other new types) that you have not yet been using. It may also mean that you have made changes to send this new type βby cableβ back to the server, in which case the GWT generator should have enabled JavaScript to marshal this type and any new types available through its βhas-aβ and is-a.
So, if it were me, I would start there: when you catch a 2-line change that increases the number of kilobytes, start by looking at the types and ask if this is the type you used earlier, and you send the new type by wire and whether this type depends on other types under the hood.
One final thought: in Ray Ryan's 2009 presentation on Google I / O, he mentioned superstition that he chose from the GWT compiler team, where they recommended not using generic types (I'm not talking about Java Generics here, but rather supertypes) as RPC arguments and return values. In particular, instead of having your RPC call take or return a card, take or return a HashMap instead. The belief that the GWT generator can then reduce the amount of serialization code that it must generate at compile time (because it can, for example, refrain from generating serialization code for TreeMap).
Hope this helps.
pohl
source share