Minimizing the compilation size of a GWT application

I have this admin site based on GWT and Sencha Ext GWT 2 , with which I have a problem, it loads very slowly using Firebug I see this

4DDF7CE1FD8584654846E8ADA9D9DECB.cache.html

about 2 MB, and so the download is slow. However, using GWT 2.5, I was able to reduce the compilation size by about 15%. However, I still need to reduce the size. I want to do this before resorting to the Code Split approach.

Using PageSpeed ​​I got these results for optimization such as Minify HTML / Javascript, etc. However, it is very difficult to use specifically for GWT code.

What are some ways to minimize compilation size besides choosing the Obfuscated mode. Is there a compression mode?

+4
source share
4 answers

You are approaching the problem of the blind. PageSpeed, as tools, most often helps with runtime performance.

1) You must enable the reporting function of the GWT compiler. Analyze the reports to get an idea of ​​what's up to a maximum of 2 MB in your application. In the GWT Maven Plugin

  <compileReport>true</compileReport> <compilerMetrics>true</compilerMetrics> <soycDetailed>true</soycDetailed> 

2) You must include the GWT compiler flags one after the other in assemblies in order to understand how much they affect. In the GWT Maven Plugin

  <disableCastChecking>true</disableCastChecking> <disableClassMetadata>true</disableClassMetadata> <optimizationLevel>9</optimizationLevel> 

3) Performance optimization advice according to Google IO 2011 in the .gwt.xml file .

 <set-configuration-property name="compiler.enum.obfuscate.names" value="true" /> 

4) Change the GWT exception stop code in prod mode in the .gwt.xml file .

 <set-property name="compiler.stackMode" value="strip" /> 

5) You must enable the GWT compiler flag to close. In the GWT Maven Plugin

 <enableClosureCompiler>true</enableClosureCompiler> 

6) Also, if you use RPC, pay attention to the method signatures. Avoid interfaces and abstract classes such as List, Map, Model in rpc arguments and return types. They help reduce rpc in your application.

Finally

The decision on the set of codes should be made based on the analysis of the GWT compiler report. GZIP compression helps to reduce bandwidth, but at the same time increases the cost of your browser and server overhead.

+12
source

Many wonderful points from the SSR. Also, be sure to confuse the RPCs as well, as they will be bloated using class references otherwise.

 <inherits name="com.google.gwt.user.RemoteServiceObfuscateTypeNames"/> 

George has some additional tips about his big GWT Blog Post .

+3
source

This huge size is not for GWT, it is for GXT widgets, I can recommend you:

+1
source

You have very few options:

  • Use code splitting.
  • Reduce the number of widgets used in the application.
  • If you have pages with a lot of text (for example, help articles), you can click this text on an external TextResource.

There are no magic solutions to reduce the size of compiled code.

+1
source

All Articles