chore(r8): drop R8 options that no longer do anything - #1371
Merged
Conversation
Four options at the top of proguard-rules.pro and three rules at the bottom were either inert or already supplied by the libraries that need them. -optimizationpasses is a ProGuard option; R8 parses and ignores it. -dontusemixedcaseclassnames only matters when writing class files to a case-insensitive filesystem, which R8 does not do when it emits DEX. The two obfuscation dictionaries point at shuffled-dictionary.txt, whose 811 entries are all exactly four characters. Without it R8 assigns names by frequency, so 736k of 1.2M member mappings get one-character names. Feeding it a fixed four-character alphabet is strictly worse, but only slightly: DEX interns strings, so the dictionary only displaced 911 of 18,601 renamed classes and cost 2,828 bytes of DEX (16,103,860 -> 16,101,032). Removing the dictionary is about dropping an 811-line file nothing else reads, not size. The retrofit2.Call/Response and kotlin.coroutines.Continuation signature rules ship in Retrofit's own META-INF/proguard/retrofit2.pro, along with the -keepattributes Signature they depend on. Retrofit 3.0.0 keeps Response and Continuation with identical rule text, and covers Call through its conditional return-type rule rather than a literal keep. -keep class * extends androidx.room.RoomDatabase in services/flipcash is subsumed by the equivalent rule Room already ships. Release R8 output is unchanged: both builds keep 21,361 classes and 1,330,404 members. Only the assigned names differ.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four options at the top of
proguard-rules.proand three rules at the bottom were either inert or already supplied by the libraries that need them.The two inert options
-optimizationpassesis a ProGuard option; R8 parses and ignores it.-dontusemixedcaseclassnamesonly matters when writing class files to a case-insensitive filesystem, which R8 does not do when it emits DEX.The obfuscation dictionaries
Both point at
shuffled-dictionary.txt, whose 811 entries are all exactly four characters. Without it R8 assigns names by frequency: 736k of 1.2M member mappings get one-character names. Feeding R8 a fixed four-character alphabet is strictly worse, but only slightly — DEX interns strings, so a longer name costs pool bytes once rather than per reference.Measured on two release builds of this branch's parent:
2,828 bytes. Removing the dictionary is about dropping an 811-line file nothing else reads, not about size.
The Retrofit signature rules
retrofit2.Call,retrofit2.Responseandkotlin.coroutines.Continuationare kept by Retrofit's ownMETA-INF/proguard/retrofit2.pro, which also carries the-keepattributes Signature, InnerClasses, EnclosingMethodthey depend on. Retrofit 3.0.0 keepsResponseandContinuationwith identical rule text;Callis covered by its conditional return-type rule (-if interface * { @retrofit2.http.* public *** *(...); } -keep,allowoptimization,allowshrinking,allowobfuscation class <3>) rather than a literal keep.Room
-keep class * extends androidx.room.RoomDatabaseinservices/flipcash/consumer-rules.prois subsumed by the equivalent rule Room already ships.Release R8 output is unchanged across the two builds: both keep 21,361 classes and 1,330,404 members. Only the assigned names differ.