Obfuscation - optimisation?

Bryce McKinlay mckinlay@redhat.com
Wed Nov 24 17:58:00 GMT 2004

Martin Egholm Nielsen wrote:

>>  > >> 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...

10000 object instances, or 10000 different classes? The length of method 
names will not have any effect on the memory usage for each object. 
Longer method names will make each _class_ consume more memory, but in 
the context of a large application, the difference is likely to be 
pretty negligable.


More information about the Java mailing list