top | item 45754669

(no title)

the_hoser | 4 months ago

One of the biggest optimizations it offers is shrinking the size of the classes by obfuscating the names. If you're obfuscating the names anyway, there's no reason that the names have to be the same length.

"hn$z" is a heck of a lot smaller than "tld.organization.product.domain.concern.ClassName"

discuss

order

mort96|4 months ago

So we're not talking about runtime performance, but some minor improvement in loading times? I assume that once the JVM has read the bytecode, it has its own efficient in-memory structures to track references to classes rather than using a hash map with fully qualified names as keys

swiftcoder|4 months ago

Proguard was heavily influenced by the needs of early Android devices, where memory was at a real premium. Reducing the size of static tables of strings is a worthwhile optimisation in that environment

throwaway2037|4 months ago

Even a hash map with fully qualified names as keys wouldn't be so bad because Stirng is immutable in Java, so the hash code can be cached on the object.

saagarjha|4 months ago

The names need to be stored somewhere because they are exposed to the program that way

voxic11|4 months ago

Yeah in some ways the obfuscation and mappings are similar to minification and sourcemaps in javascript.

mort96|4 months ago

And minification in JavaScript only reduces the amount of bytes that has to be sent over the wire, it doesn't improve runtime performance.