Click here to load reader
Upload
mohammed-kharma
View
53
Download
3
Embed Size (px)
DESCRIPTION
How to speedup GWT compiler
Citation preview
Google Toolkit Widget
How to increase the speed of GWT 1.5 compiler?
ByMohammad Fahmi KharmaWeb developer Jan, 2009
How to increase the speed of gwt compiler?
One of the good feature in gwt is cross browser support ,so you can deal with several type of browse in simple way if we compare it to previous code “pure java script”.
The idea to more effective compilation time especially during development can be done by 1-Increase the memory of the computer ….but this is not enough.2- go to GWT_HOME directory and open gwt-user.jar .3-open the following file gwt-user.jar\com\google\gwt\i18n\I18N.gwt.xml4-replace these line:
<define-property name="locale" values="default" />With this one:<define-property name="locale" values="en_UK" />
This will force one local instead the predefined local which while reduce the compilation time as we will illustrate later
5-Go to gwt-user.jar\com\google\gwt\user\UserAgent.gwt.xml
Now we want to define the target sensitive supported browse code, so replace this line <define-property name="user.agent" values="ie6,gecko,gecko1_8,safari,opera"/>With this one ”for firefox” <define-property name="user.agent" values="gecko1_8"/>
AndReplace all of this tag in the same file<property-provider name="user.agent">….
.
.</property-provider>With this<property-provider name="user.agent"><![CDATA[ var ua = navigator.userAgent.toLowerCase(); var makeVersion = function(result) { return (parseInt(result[1]) * 1000) + parseInt(result[2]); }; if (ua.indexOf("msie") != -1) { var result = /msie ([0-9]+)\.([0-9]+)/.exec(ua); if (result && result.length == 3) { if (makeVersion(result) >= 6000) { if (makeVersion(result) >= 1008)
return "gecko1_8"; } } } return "unknown"; ]]></property-provider>So, what is exactly happen?
GWT use code optimization and take into consideration the sensitive code that run in the browser so, when we replace the local in the above code with en_UK , we define one local and one browse as in 5 above, this result the following:
GWT compute permutations between locales and browser, in the default mode There Is 7 locales in default and 5 browsers
At this time you reduce the time of compilation and its become most likly normal,Look after finish the development you must redefine the supported locales and browsers