[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: optimizing for size



Of course, the success of this approach will depend
on whether you measure size just in terms of your application classes or
in terms of the whole body of bytecode needed to execute the program.
Certainly your application classes will be smaller if they can refer to
system classes by names like a/b/c/ instead of java/lang/String.

I've been thinking about a relatively simple technique to achieve this: generating static forwarding methods. If I have N classes that call a system class method, the system class and method name is repeated N times in the constant pools, and obfuscators can't touch the strings. Those calls could be replaced by an application-defined static method that calls the system class method, and the obfuscator will then compress that class/method name in the N original class files. I'm not sure where the break-even point is in terms of overall space yet.


Thanks for all the suggestions; in particular, "--via-shimple" doubled the space saved (3.5k on a 60k jar file vs 1.7k without).