Sunday, June 24, 2012

Re: How far does the optimizations of the GWT compiler go..?

I once wrote a library of classes, and wrote a test program that exercised a few of them. 

Then I looked at the javascript generated in 'pretty' mode.  It was very tiny, only the few methods I used where included, and many of the local variables etc where removed through optimizations etc.  For the large classes, they where reduced in size, to almost nothing... since I didn't use the functionality, it was totally stripped out.   I was also surprised to see my calculations that called various methods where often completely replaced with a constant,  since my test program specified the inputs to the methods, the compiler was able to calculate the result, and reduce it to a single value...

It is very good at optimizing out what you don't use..

Mike.


On Thursday, June 21, 2012 10:17:53 AM UTC-10, Carsten wrote:
Hi,

I was wondering how well the GWT compiler is able to remove unused parts? Can it even remove methods and fields from a class which are never used?

Example:

VeryComplexObject vco = null;

initVCO() {
...
};

If initVCO is never called from my code, will the GWT compiler remove the method initVCO(), the field vco, or even the VeryComplexObject class itself?

Can I somehow check what the GWT compiler removed and what not? Is there a log which lists removed parts?

Thanks,
Carsten

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/ck-ihF_2NAQJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment