Obfuscation - optimisation?
Martin Egholm Nielsen
Wed Nov 24 15:17:00 GMT 2004
> > >> Well, it would make all classes significant smaller - at least it
> > >> does in the class-file situation. All the
> > >> niceAndDescriptiveMethodName() methods and fields will have their
> > >> names decimated into something that does not take up so much space.
> > And maybe in memory footprint? I don't quite know how the
> > memory-model/behaviour is.
> It might. I don't know what the obfuscator does, but if it shortens
> the names of methods and fields the file will be smaller. However,
> other stuff will stop working it it does this, so I don't believe it
> can help very much.
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)
More information about the Java