简体   繁体   中英

A couple questions about Baseline Profiles in Android

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.

  1. 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)

  2. 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?

  1. 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?

  1. 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.

  1. 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.

  2. You don't. Disabling JIT compilation for users of your app is not recommended at all.

  3. This is part of the first release of profile installer. You no longer need to set this flag.

  4. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM