Quick hints for speeding up widgetset compilation

Compiling a widgetset may take over a minute which is a big annoyance when writing client side stuff. The compiling process takes a long time because by default GWT will compile several versions of the widgetset, one for each supported browser type. When you are writing GWT code you are probably not interested in eg. ie6 support, so you can reduce the compile time greatly by forcing GWT to compile only one version of the widgetset. This can be done by setting the user.agent property in your module descriptor. For example, I’m using FF3.5 which is Gecko based, so I’ve added

<set-property name="user.agent" value="gecko"/>

in my WidgetSet.gwt.xml. This reduced my compile time from 57 second to 26 seconds!

The list of values for the user.agent property can be found in

When you are compiling a production-version of the widgetset you probably want to include support for other browsers, so remove the property when you start to test your widgets with other browsers.

But wait, there’s more. You can also speed up the compilation in the cross-browser case by allowing the GWT compiler to use concurrent threads. This is done with the localWorkers parameter, and it means that the different permutations are compiled in parallel. My compile time went down about 20% by adding “-localWorkers 6” in the parameters.

Note that these tweaks are more or less irrelevant when using the hosted mode (with or without OOPHM).