Android カレンダー チームがベースライン プロファイルを使用してアプリの起動とジャンクを改善した方法
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
ベースライン プロファイルにより、コードの実行速度が最大 30% 向上
インタープリタとジャストインタイム(JIT)コンパイル
手順
一般的なユーザージャーニーの
トラブルシューティングを行えますベースライン プロファイルを使用すると、ユーザー ジャーニーを
アプリの起動の改善やジャンクの削減などに役立つ
ユーザー維持率や評価などのビジネス指標の向上につながります。
ベースラインの詳細
プロファイル。
Android カレンダー チームはベースライン プロファイルを実装し、約 20% のアプリが確認されました。
起動時間が短縮され、遅いフレームやフリーズしたフレームが約 50% 減少しました。こちらが
パフォーマンス面の成功を達成するために何を
エンドツーエンドで行ったのか
影響の測定方法にベースライン プロファイルを使用することにしました。
クラウド プロファイルとベースライン プロファイル
Android のカレンダー チームはすでに Cloud
プロファイルでは、
は、実際のユーザーに基づくプロファイルに基づく最適化(PGO)手法の 1 つです。
記録します。クラウド プロファイルとベースライン プロファイルが
比較:
プロファイル タイプ |
設定 |
含まれるユーザー ジャーニー |
ユーザーベースが次の場合に最適に機能 |
実現した効果 |
サポートされている Android バージョン |
クラウド プロファイル |
デフォルトで有効 |
実際のユーザーデータに基づき自動的に選択 |
大 |
数日以内 |
Android 9(API レベル 28)以降 |
ベースライン プロファイル |
自分で構成 |
自分で選択 |
すべてのサイズ |
即時 |
Android 7(API レベル 24)以降 |
Android カレンダー チームがベースライン プロファイルを追加した主な理由の 1 つは、
より速い週次リリースサイクルに移行していたからです。
クラウド プロファイルを使用するとパフォーマンスが大幅に向上しますが、これには 1 ~ 2 日かかります
アプリのリリース後に最大限の効果を得るのに
現実のユーザーデータを集約できます。クラウド プロファイルをベースラインで補完する
プロファイルにより、ユーザーが最高のパフォーマンス向上を実感する時間が長くなる
リリースする前に確認できます
さらに、Android カレンダー チームが次のことを行えるようにすることも重要でした。
対象とするクリティカル ユーザー ジャーニー(CUJ)を
これは、ベースライン プロファイルを使用して行うことができます。
通常は、クラウド プロファイルに加えてベースライン プロファイルを使用することをおすすめします。
パフォーマンスが最大限に高まるようにする必要があります。
含まれるユーザー ジャーニー
Android カレンダー チームは、ベースライン プロファイルに次の 2 つの CUJ を含めることにしました。
- スケジュール ビューでアプリを開く: 最初はデフォルト ビューなので、
アプリを初めて使用するユーザーや
できます。
- [月] ビューでアプリを開く: ユーザーに基づいて、多くのユーザー向けに選択されたビュー
分析できますユーザーがどのようにアプリを使用しているかを追跡するには、
Firebase。
一般的に、ビジネスにとって収益性の高い CUJ を追加する必要があります(
CUJ などがあります。P-MAX を選択すると
最適化する CUJ。最適化する CUJ
一致します。
実装
Android カレンダー チームは、Android アプリの
Jetpack Macrobenchmark ライブラリ
ベースライン プロファイルを生成して、社内ツールやリソースとの統合を容易に
一般的なスケーラビリティは重要です
スケジュールどおりにアプリを起動するための Macrobenchmark テスト構成は次のとおりです
view:
@Test
fun generateProfile() =
baselineProfileRule.collect(PACKAGE_NAME, includeInStartupProfile = true) {
startActivityAndWait()
// Verify pre-existing recurring events and tasks are shown.
device.waitAndFindObject(By.text("Recurring event"), 20_000)
device.waitAndFindObject(By.text("Recurring task"), 20_000)
// Open drawer and verify selected view.
device.findObject(By.desc("Show Calendar List and Settings drawer")).click()
device.waitAndFindObject(By.desc("Schedule view, Selected"), 1_000)
}
管理されたリリースを使用して影響を測定する
ベースライン プロファイルは、同梱される APK と密接に結びついているため、
組み込まれていないと標準的な A/B テストを実行できない
その影響を把握できますAndroid カレンダー チームは
管理されたリリースを使用して影響を正確に測定し、
一部のユーザーにのみ新しいバージョンをリリースし、
以前のリリースと類似したバージョンのユーザーに
リリースされます
ベースライン プロファイルを使用すると、次のような
複数の領域で改善が行われています。これらの統計情報は、さまざまなデータ
すべてのユーザー(スケジュール ビューと月ビューで開始したユーザー)
ユーザーも大きなメリットを得られますが、他にも次のようなメリットがあります。
カレンダー データの読み込みなど、共有プロセスの最適化
データベースです
- インタラクティブ アプリの起動(最も一般的なシナリオ)のレイテンシの中央値が
775 ミリ秒~ 644 ミリ秒(17%)
- コールド スタート レイテンシの中央値が 1,058 ミリ秒から 901 ミリ秒(15%)に減少
- ウォーム スタート レイテンシの中央値が 453 ミリ秒から 378 ミリ秒に減少(17%)
- スケジュール視聴回数と月視聴回数でジャンクのあるフレームレートの中央値が 42 ~ 60% 減少
クラウド プロファイルをベースラインと併用する場合は、
プロファイルの改良点は、
最初の週にクラウド プロファイルが生成されるとき。ただし、
ベースライン プロファイルを他のものの上に置くことで、パフォーマンスの大幅な向上が観察される
確認できます
ツールや機能の詳細については、次のリソースをご覧ください。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-07-27 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-27 UTC。"],[],[],null,["# How the Android Calendar team improved app startup and jank with Baseline Profiles\n\nBaseline Profiles improve code execution speed by up to 30% by avoiding\ninterpreter and just-in-time (JIT) [compilation\nsteps](https://source.android.com/docs/core/runtime/jit-compiler#architectural-overview)\nfor common user journeys. Baseline Profiles let you choose the user journeys you\nwant to optimize and can help improve app startup, reduce jank, and more---which\nin turn result in improved business metrics, such as user retention and ratings.\n[Learn more about Baseline\nProfiles](/topic/performance/baselineprofiles/overview).\n\nThe Android Calendar team implemented Baseline Profiles and observed \\~20% app\nstartup time improvement and \\~50% reduction in slow or frozen frames. Here's\nwhat they did end-to-end to achieve these performance wins, from why they\ndecided to use Baseline Profiles to how they measured impact.\n\nCloud Profiles v. Baseline Profiles\n-----------------------------------\n\nThe Android Calendar team had already been using [Cloud\nProfiles](/topic/performance/baselineprofiles/overview#cloud-profiles), which\nare another Profile Guided Optimization (PGO) method based on real-world user\ninteractions with the app. Here's how Cloud Profiles and Baseline Profiles\ncompare:\n\n| Profile type | Set up | User journeys included | Works best when user base is | Impact realized | Supported Android versions |\n|-------------------|--------------------|----------------------------------------------------|------------------------------|----------------------|-------------------------------------|\n| Cloud Profiles | Enabled by default | Chosen automatically based on real-world user data | Large | Within a couple days | Android 9 (API level 28) and higher |\n| Baseline Profiles | Configured by you | Chosen by you | All sizes | Immediate | Android 7 (API level 24) and higher |\n\nOne key reason the Android Calendar team decided to add Baseline Profiles to\ntheir codebase was because they were moving to a faster, weekly release cycle.\nWhile Cloud Profiles provide significant performance gains, it takes 1-2 days\nafter app launch for them to reach their peak impact because they rely on\naggregating real-world user data. Supplementing Cloud Profiles with Baseline\nProfiles gives users more time to experience peak performance improvements\nbefore the next app version rolls out.\n\nAdditionally, it was important for the Android Calendar team to be able to\nchoose which critical user journeys (CUJs) specifically are included in the\nprofile, which you can do using Baseline Profiles.\n\nGenerally, we recommend using Baseline Profiles in addition to Cloud Profiles,\nenabled by default, for the best performance outcomes.\n\nUser journeys included\n----------------------\n\nThe Android Calendar team chose to include two CUJs in their Baseline Profiles:\n\n- Opening the app in schedule view: initially the default view, so important to optimize for users using the app for the first time or who don't change the default settings.\n- Opening the app in month view: the chosen view for many users, based on user data. To track how users are using your app, you can use tools such as [Firebase](https://firebase.google.com/docs/analytics).\n\nGenerally, you should add the CUJs that are profitable for the business (if\napplicable) and CUJs that are most common. To learn more about how to choose\nCUJs to optimize, see [What to\ninclude](/topic/performance/baselineprofiles/overview#what-to-include).\n\nImplementation\n--------------\n\nThe Android Calendar team uses an internal wrapper for the\n[Jetpack Macrobenchmark library](/topic/performance/baselineprofiles/measure-baselineprofile)\nto generate Baseline Profiles for ease of integration with internal tools and\ngeneral scalability.\n\nHere's the Macrobenchmark test configuration for opening the app in schedule\nview: \n\n @Test\n fun generateProfile() =\n baselineProfileRule.collect(PACKAGE_NAME, includeInStartupProfile = true) {\n startActivityAndWait()\n // Verify pre-existing recurring events and tasks are shown.\n device.waitAndFindObject(By.text(\"Recurring event\"), 20_000)\n device.waitAndFindObject(By.text(\"Recurring task\"), 20_000)\n\n // Open drawer and verify selected view.\n device.findObject(By.desc(\"Show Calendar List and Settings drawer\")).click()\n device.waitAndFindObject(By.desc(\"Schedule view, Selected\"), 1_000)\n }\n\nMeasure impact using controlled releases\n----------------------------------------\n\nSince Baseline Profiles are tightly coupled with the APK they're shipped with\nand incorporated before your app runs, it's not possible to run a standard A/B\nexperiment to understand their impact. However, the Android Calendar team was\nable to get an accurate measure of impact using *controlled releases*, where you\nessentially release the new app version to only a subset of users and compare\nthem to users who are on a version similar to the previous release.\n\nWith Baseline Profiles, they saw the following immediate, significant\nimprovements in multiple areas. These stats are aggregated across a wide range\nof devices and across all users---those who start in schedule and month view\nlikely gain the biggest benefits, but other users also benefit due to the\noptimization of shared processes such as loading calendar data from the\ndatabase.\n\n- Median interactive app startup (most common scenario) latency decreased from 775ms to 644ms (17%)\n- Median cold start latency decreased from 1,058ms to 901ms (15%)\n- Median warm start latency decreased from 453ms to 378ms (17%)\n- Median janky frame rate decreased by 42-60% in schedule and month views\n\nKeep in mind that if you use Cloud Profiles in conjunction with Baseline\nProfiles you'll likely see the improvements decrease slightly over the course of\nthe first week, as Cloud Profiles are generated. However, you should still\nobserve significant performance gains with Baseline Profiles on top of other\noptimizations you have in place.\n\nTo learn more about the tools and features, see the following resources:\n\n- [About Baseline Profiles](/topic/performance/baselineprofiles/overview)\n- [Benchmark Baseline Profiles with Macrobenchmark\n library](/topic/performance/baselineprofiles/measure-baselineprofile)"]]