Obfuscation - optimisation?

Martin Egholm Nielsen martin@egholm-nielsen.dk
Thu Nov 25 09:03: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.
>> 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.
Dooh! That does seem resonable :-)
Then with my compressed filesystem, this would have little effect. Then 
the only effect would be decimation of methods and fields unused, but I 
have none of those :-)
But maybe for the xerces-package I reckon there will be alot to gain, 
since I only use the SAX-parser...

Thanks for all the clearifications and help,

More information about the Java mailing list