Obfuscation - optimisation?
Sun Dec 5 18:32:00 GMT 2004
> I just tried creating some manual obfuscation of some dummy classes. I
> made a class with a long (50 chars) class-name, long (100 chars)
> field-name and long (130 chars) method name. A similar obfuscated
> class was created with one character long names. Next, I created 10000
> instances of both (and kept references to all of them), and saw that
> they consumed the exact same amount of memory...
> This was of course a small test, but I think it's conclusive that
> obfuscation on names does _not_ reduce memory footprint.
> Maybe it was obvious?! :o)
Well, this is really true - Method instances do not include the name of
there classes - I think they only store something like a descriptor or a
pointer where the class-information can be looked up in a hashtable or
something like this.
But proguard does things like removing unsused stuff VERY efficient or
making methods that are never orverridden final. removes code withought
Well, for libraries this is stupid, but for applets or stand-alone apps
this IS indeed very helpful. It makes programs much smaller (-20-40%)
and also faster.
Of course this could also done all in gcj itself (and to be honest I
dont know whats currently done) but till its there proguard is a way to
enhance your applikation with next to null work.
Btw. I was not able to build "optimized" code with gcj, though proguard
claims to create valid bytecode (and warns of options that doesnt).
More information about the Java