Tuesday, January 10, 2012

How do I optimize GWT compiler for faster compilation?

I use eclipse IDE for my GWT application development. GWT is a great way to develop web applications but to do quick server side code test takes long time due to GWT compilation process. Thankfully I found a way to speed up GWT compilation by making small configuration changes.

If you are targeting specific browser then you can always define user agent in UserAgent.gwt.xml file as follows:

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

You can also speed up by isolating locales as follows:

<extend-property name='locale' values='en'/>

In the newer versions of GWT, you can add <collapse-all-properties /> to your yourapp.gwt.xml for development purposes. That will tell the GWT compiler to create a single permutation which covers all locales and browsers. That means you can test in all browsers and languages but are still only compiling a single permutation.

Compiling a single permutation that handles all browsers and languages still takes a little bit more time than a single permutation that handles only one browser and language, but the difference isn't significant.

You can also try few GWT compilation options which worked for me:

 -draftCompile                Enable faster, but less-optimized, compilations
 -localWorkers               The number of local workers to use when compiling permutations
 -XdisableCastChecking EXPERIMENTAL: Disables run-time checking of cast operations
 -optimize                       Sets the optimization level used by the compiler.  0=none 9=maximum.

e.g. -draftCompile -localWorkers 4 ( I gave -localWorkers as 4 because I have four processers.)

-draftCompile and -optimize don't work well togather. if you use "-optimize 9" that is suppose to optimize the code and -draftCompile seems to do just oposite of it.

-XdisableCastChecking and -optimize will make your GWT compilation slow but your GWT application will  speed up by 2-5% at run-time.

If you run the GWT compiler with the -localWorkers flag, the compiler will compile multiple permutations in parallel. This lets you use all the cores of a multi-core machine, for example -localWorkers 2 will tell the compiler to do compile two permutations in parallel. You won't get order of magnitudes differences (not everything in the compiler is parallelizable) but it is still a noticeable speedup if you are compiling multiple permutations.

Look at following screen shot for more information:

For more information look at GWT Compiler Options.

I also did extra bit of tweak which would  be basic for any java guy by setting VM arguments in GWT compilation option as follows:


Yes, it is not much but you get the idea. You can tweak according to type of JVM you are using and type of machine configuration you have like RAM, number of processors, etc...

  1. Blog post on how to speed up GWT compiler: http://stackoverflow.com/questions/1011863/how-do-i-speed-up-the-gwt-compiler
  2. Collapse all property option for soft compilation: http://code.google.com/p/google-web-toolkit/wiki/SoftPermutations
  3. GWT Compiler Options: http://code.google.com/webtoolkit/doc/latest/DevGuideCompilingAndDebugging.html#DevGuideCompilerOptions

where is AndroidManifest.xml file in monodroid project?

You won't see an AndroidManifest.xml in a project by default. If you do decide to, you can manually create it or create it in the project properties. This file the permissions that an application needs to run. This can include things like the version of the API required for an application to run as well as access to what features on the device an application needs. These can be set by editing the file hand or by modifying the project's properties -> Android Manifest Tab.

For more information, visit following link:

Title: Working with AndroidManifest.xml
Link: http://mono-android.net/Documentation/Guides/Working_with_AndroidManifest.xml

Monday, January 2, 2012

How to access GWT application running in development mode from different machine?

I was using eclipse for my GWT application development. I wanted to test GWT application from different browsers. I was unable to access my GWT test application running on development mode from external machine. After bit of investigation, I found below solution that helped me expose development mode application to external IP address.

In eclipse Go to -> Debug Configurations... -> Arguments -> Program arguments -> add param at the end " -bindAddress" -> Apply -> Start Debug

References: http://stackoverflow.com/questions/4466193/how-to-check-gwt-application-in-dev-mode-from-another-computer/4469325#4469325

Example code to connect node.js REST service with Eureka discovery service

Eureka is Spring based discovery service developed by Netflix. To know how Eureka is used at Netflix visit: https://github.com/Netflix/e...