Baseline Profiles x R8/Proguard

1.2k views Asked by At

I've been experimenting with Android's Baseline Profile & MacroBenchmark libraries for improving the app performance.

The question I have is that it is suggested that the MacroBenchmark's build-types be as close to the release build but with -dontobfuscate in the proguard rules.
If the production app is going to be obfuscated via minification then how can Baseline Profiler help in app performance as the classes could be completely different in baseline-prof.txt & in the app's classes.dex file.

Is there some sort of mapping happening internally between Profiler & Proguard/R8?

2

There are 2 answers

0
darshan On BEST ANSWER

I asked the same question on the Google Issue Tracker & was told that the Baseline Profile also participates in the obfuscation process & the classes/methods recorded by the benchmark are refactored with the new obfuscated ones during the obfuscation.

Source: Check comment#2.

3
sgjesse On

I edited this after consulting with the Baseline Profule team.

The support for Baseline Profiles will do a "best effort" mapping of the baseline profile from the input program to the R8 generated app using the R8 mapping file. As the mapping file generated by R8 is only designed to be able to map from the generated app back to the orignial app, so mapping the other way is not complete. The "best effort" usually will work quite well, but might not be complete.