not fairly Baseline Profile, The place Artwork Thou? | by Akash Khunt | Feb, 2023 will cowl the most recent and most present steerage roughly the world. admittance slowly for that motive you comprehend skillfully and appropriately. will lump your information proficiently and reliably
NOTE: Though it isn’t an actual continuation of my former medium publish, it will be nice when you learn it as effectively to study different points you may face when measuring the influence of baseline profiles on OPPO, oneplus both xiaomi gadgets.
Additionally, since there are already many articles and documentation on totally different utility startup states and primary profiles, I do not plan to cowl it right here; as an alternative, when you’re curious, you’ll be able to scroll to the underside of this publish for reference hyperlinks.
I lately had a mission to enhance the efficiency of the Chilly Begin utility for one in all my shoppers. I used to be in a position to generate the reference profiles with none downside, since I had already accomplished related workouts a number of occasions prior to now. I examine the influence it has on me iQOO 7 (specs: SD870G + 8GB RAM + 128GB and Android 13) system and I might see a good enchancment the place the time invested by Jit Thread Pool throughout chilly begin the appliance dropped to 41mswhat was it 212ms earlier than, that’s 80% discount 🙂.
Then I actually needed to do the identical train on a cheap system. OPPO A15 (specs: Helio P35 + 2GB RAM + 32GB and Android 10) as right here the time invested by Jit Thread Pool was 2180ms (i.e. ~2.2s) so I hoped to avoid wasting at the least 1000ms (ie 1s). So I benchmarked in opposition to a benchmark profile construct and to my shock I did not see any discount within the chilly begin time of the app 🤔. So I opened one of many systrace generated throughout profiling utilizing macro reference level and checked the time spent by Jit Thread Pool which was nonetheless very related, i.e. ~2048ms.
My first thought was that possibly there was an issue within the check execution, so I ran the assessments 2 extra occasions, however nonetheless no enchancment. Then I believed possibly as a result of Android 10 would not work correctly so I went via the documentation and located that it ought to work on all Android24+ APIs gadgets. Lastly, I got here to the conclusion that it was time to placed on the Sherlock hat and put together the magnifying glass to research the matter. 🕵
Notice: I used AGP model 7.3.1, MacroBenchmark model 1.1.1 and ProfileIntsaller model 1.2.2 to measure the influence of the benchmark profile.
Since I am unable to present the precise venture I am engaged on for a lot of causes, I’ll use Now within the Android app to show the identical downside. I carried out chilly boot assessments with and with out base profile on the identical Oppo A15 system. As you’ll be able to see within the following screenshots, the time spent by Jit Thread Pool with and with out reference profiles was virtually the identical, i.e. 367ms and 337ms respectively.
For reference, you too can see the results of the identical assessments on the iQOO 7 system under, the place the time spent per Jit Thread Pool with and with out reference profiles was 75ms and 0.6ms 😲 respectively.
I then began digging via the logs generated throughout the BaselineProfile assessments to see if I might discover any clues. After spending a couple of hours, I discovered some statements (similar depend as check iteration depend) that stated “Skip profile set up for com.google.samples.apps.nowinandroid.benchmark” as proven under, which made it concrete that for some motive the baseline profiles weren’t putting in appropriately.
Then I checked all Recognized points with Baseline Profiles and completed two of the objects talked about there that may intrude with the set up of the Baseline profile.
- Battery optimizations can intrude with profile set up. To make sure that your profiles set up successfully, please disable any battery optimization in your reference gadgets.
- Android Studio profilers don’t set up the baseline profiles when the (downside) utility is profiled.
I checked that there was no battery optimization enabled on Oppo A15 and the battery was additionally at 100%. Concerning the second subject talked about above, from an excellent UX perspective, I believed I ought to have gotten an error if that was the case, much like what we get when profiling on a tool with low battery or an emulator. Lastly, I believed I would strive the most recent releases of macro reference level (that’s to say 1.2.0-alpha09) and profile installer (1.3.0-alpha03) to confirm that it isn’t an issue with the dependencies you had been utilizing.
I checked the variations after which ran the assessments once more, however this time the check returned an error saying “Verify failed”. This at the least made me glad, as now I do know there’s a downside with the baseline profile assessments, not like earlier than the place if the person would not examine the logs, they do not get to know why the baseline profiles are. base didn’t work. I then adopted the stacktrace, which led me to cmdPackageCompile() operate the place the results of “cmd package deal compile -f -m $compileArgument $packageName” was being matched with “Success” string as proven under.
This made me marvel why this error did not happen sooner, so I reverted the model subject and checked the identical. cmdPackageCompile() and I noticed that in earlier variations the output of the identical package deal construct command was not asserted 💡, which made it clear why there was no error earlier than. For reference, you’ll be able to view the supply code of cmdPackageCompile() operate up androidx.benchmark:benchmark-*:1.2.0-alpha06 and above within the screenshots under.
To examine if this was an OEM particular subject i.e. Oppo, I ran the identical assessments on Xiaomi and OnePlus gadgets. On Xiaomi system, testing labored nice, however confronted related subject on OnePlus system (Owned by Oppo now), so I lastly concluded that it’s an OEM particular subject.
After this investigation, I now know that in case I do not see any enchancment in benchmarks with Baseline Profiles (i.e. JIT remains to be operating at full pace), I can run the next command to examine if Baseline Profile is even appropriate with the system. or examine the logs within the BaselineProfile check. 🙂
"adb shell cmd package deal compile -f -m speed-profile $YOUR_PACKAGE_NAME"
I hope the article about Baseline Profile, The place Artwork Thou? | by Akash Khunt | Feb, 2023 provides perception to you and is beneficial for including as much as your information
Baseline Profile, Where Art Thou? | by Akash Khunt | Feb, 2023