I read the docs and watched a couple videos about the benefits of baseline profiles, how to benchmark and how to generate them. Still I have a couple questions that I couldn't answer myself with the help of the docs.
As soon as I have my baseline-prof.txt file inside my main folder (next to Manifest.xml) is that enough for it to take affect? So all I need to do now is sign my release bundle and upload it to Google Play? (I have the profileinstaller dependency added to build.gradle)
In case I want to deactivate the JIT compiler completely and force ART to use AOT Compiler I have to execute following command:
adb shell cmd package compile -m speed -f my-package
but this only changes to compilation method for the app running on my device, how can I now get a signed release bundle to upload it to Google Play so everyone who downloads my app has to use AOT compiler?
- While reading through the profileinstaller docs: https://developer.android.com/jetpack/androidx/releases/profileinstaller I came across the following line:
Enable adding baseline-prof.txt files to AAR artifacts, and binary profiles to APKs android.experimental.enableArtProfiles=true
Does that mean this line is essential for the Baseline Profiles to get installed in the APK?
- Why do I need to side-load my baseline profiles if I want to test it on my device? And why is it working right out of the box when I upload it to Google Play?
Are there any more resources on this topic that I'm missing? The baseline profile docs are a bit inadequate imo.
CodePudding user response:
You need to add the profile installer dependency to your app as well. To verify that it got added to the app itself, drop the app into Android Studio. This will open the apk inspector. Look for
/assets/dexopt/baseline.prof{m}
files. If they're there your app will use the baseline profile provided.You don't. Disabling JIT compilation for users of your app is not recommended at all.
This is part of the first release of profile installer. You no longer need to set this flag.
To test a Baseline Profile's efficiency locally, we recommend using a macrobenchmark test like in the samples.
As for your general comment on the docs, we're working on bringing them up to date, but generally you got the right idea.