I have this admin site that is based on GWT
and Sencha Ext GWT 2
that I am having problem with, it loads very slowly,
using Firebug I can see this
4DDF7CE1FD8584654846E8ADA9D9DECB.cache.html
is roughly around 2MB now and that is why loading is slow. Using GWT 2.5 however I was able to reduce the compile size for about 15%. However I still need to reduce the size further. I want to do this before resorting to the Code Split approach.
Using PageSpeed I got this results for optimization, like Minify HTML/Javascript, etc however its very hard to apply specially for a GWT code.
What are the ways to minimize compile size, beside choosing Obfuscated mode. Is there like a compressed mode?
You are approaching the problem blind sided. PageSpeed like tools help more often in runtime performance.
1) You should turn on Reporting feature of GWT Compiler. Analyze the reports to have insights into what in your application contributes maximum to that 2 MB. In GWT Maven plugin
<compileReport>true</compileReport>
<compilerMetrics>true</compilerMetrics>
<soycDetailed>true</soycDetailed>
2) You should turn on GWT Compiler flags one by one across builds to understand how much they impact. In GWT Maven plugin
<disableCastChecking>true</disableCastChecking>
<disableClassMetadata>true</disableClassMetadata>
<optimizationLevel>9</optimizationLevel>
3) Performance Optimization tip as per Google IO 2011 in .gwt.xml file.
<set-configuration-property name="compiler.enum.obfuscate.names" value="true" />
4) Strip out GWT exception stacktrace code in prod mode in .gwt.xml file.
<set-property name="compiler.stackMode" value="strip" />
5) You should turn on GWT Compiler flag for closure. In GWT Maven plugin
<enableClosureCompiler>true</enableClosureCompiler>
6) Also if you are using RPC, then pay attention to the method signatures. Avoid interfaces and abstract classes like List, Map, Model in the rpc arguments and return types. They help in reducing rpc footprint in your application.
The decision to codesplit should be taken based on analysis of GWT compiler report. GZIP compression helps to reduce your bandwidth footprint but at the same time adds cost to your browser and server overhead.
A lot of great points by SSR. Also, don't forget to obfuscate your RPC's as well, as they will be bloated with class references otherwise.
<inherits name="com.google.gwt.user.RemoteServiceObfuscateTypeNames"/>
George has some additional tips on his great GWT Blog Post.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With