Repository navigation
Commit 1a46bb8
authored
perf(r8): drop the protobuf and gRPC server keep rules (#1370)
* perf(r8): drop the protobuf and gRPC server keep rules
`-keep class * extends GeneratedMessageLite { *; }` and its $Builder twin pinned
29,633 items — 94% of the app's entire keep radius — and blocked R8 from optimizing
24,909 methods, 81% of every method it was forbidden to touch. Both are replaced by a
field-only rule that now ships inside com.flipcash:{ocp,flipcash2}-client-protocol,
where the generated messages live. javalite resolves fields reflectively and reaches
builders and message methods from ordinary call sites, so the methods never needed
keeping.
`-keep class * implements io.grpc.BindableService { *; }` goes with them. All 45
matches were *ImplBase and *CoroutineImplBase server skeletons generated alongside the
client stubs; nothing in an Android client implements a gRPC service, and no other rule
kept them, so R8 can now delete them outright.
Measured by the R8 configuration analyzer, before and after:
live methods 230,686 -> 205,144 (-25,542)
live classes 42,338 -> 41,770 (-568)
live fields 96,939 -> 95,692 (-1,247)
obfuscation score 89.0% -> 96.1%
optimization score 89.3% -> 96.3%
shrinking score 89.1% -> 96.1%
The AbstractStub rule stays for now. It pins 114 classes with all members and the stubs
are reached from generated newStub() factories, so it is very likely removable too, but
that one needs a run on a device rather than a static argument.
Merges after both contract packages publish the rule; the pinned versions in
libs.versions.toml have to carry it first.
* build(deps): take the contract packages at 0.3.0 for their keep rules
0.3.0 is the first release of either package to ship
META-INF/proguard/*.pro alongside its generated messages, which is what makes
the removal of the app's own protobuf rules in this branch safe. Both jars on
Central carry the rule; R8 reads it straight out of the dependency.
Pinning the version and dropping the local rules in one change keeps the app
from ever sitting on a commit with no protobuf keep rule at all.1 parent efbe3e7 commit 1a46bb8
2 files changed
Lines changed: 9 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
15 | 14 | | |
16 | | - | |
| 15 | + | |
17 | 16 | | |
18 | | - | |
19 | 17 | | |
20 | 18 | | |
21 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
| |||
0 commit comments