GWT compile的時間很長,編碼》編譯》測試》修改,這樣的過程苦不堪言。
於是上網搜尋了一下如何減少GWT Compile,尤其是針對dev mode。
發布的時候,多等一會其實影響不大。
言歸正傳,根據GWT的特性,主要有兩個方面可以入手。
1. 更好的利用硬體
- 如果你使用Ant,如果有多個module需要編譯,可以使用<pararell>來同時編譯幾個module。
- 使用-localWorkers參數,制定GWTC利用多個線程來進行compile。
2. 簡化Permutation編譯
預設,GWT會針對不同的瀏覽器,產生不同的代碼,但是開發測試的時候,我們往往只用一種瀏覽器,比如Firefox。
- 通過在module.gwt.xml中添加user-agent屬性,可以指定GWT只為特定瀏覽器產生頁面和代碼。針對Firefox,使用gecko1_8, 不要使用gecko。
- 還可以制定locale,減少編譯輸出的檔案
- 使用-draftCompile參數
3. 參考:
- A Few Ways To Get Better GWT Compile Times
http://supplychaintechnology.wordpress.com/2010/06/04/gwt_compile_times/
- How to speed up the GWT compiler
http://bazoud.free.fr/post/2008/07/31/can-i-speed-up-the-gwt-compiler/
- Finding Supported GWT user.agent values
http://www.mooreds.com/wordpress/archives/574
http://stackoverflow.com/questions/890352/gwt-module-xml-how-to-redefine-and-use-more-than-one-user-agent