استخدام ملف شخصي أساسي
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تحسّن الملفات الشخصية المرجعية سرعة تنفيذ الرمز بحوالي 30% من الإطلاق الأول من خلال تجنُّب التفسير وخطوات التجميع في الوقت المناسب (JIT) لمسارات الرموز المضمَّنة. من خلال شحن ملف شخصي أساسي في تطبيق أو مكتبة، يمكنك تفعيل
وقت تشغيل Android (ART) لتحسين مسارات الرموز البرمجية المضمّنة من خلال التجميع
المسبق (AOT)، ما يوفّر تحسينات في الأداء مع كل
عملية تثبيت جديدة للتطبيق وكل تحديث للتطبيق. وتتيح ميزة التحسين الموجَّه من خلال الملف الشخصي (PGO) للتطبيقات إمكانية تحسين بدء التشغيل وتقليل معدّل التفاعل وتحسين الأداء العام لوقت التشغيل منذ الإطلاق الأول للمستخدمين النهائيين.
إنشاء اعتبارات الأداء
يتم توزيع ميزة ComposeAllowed كمكتبة بدلاً من أنّها جزء من نظام Android الأساسي.
يتيح هذا الأسلوب لفريق Compose تحديث تطبيق Compose بشكلٍ متكرر ودعم مجموعة واسعة
من إصدارات Android. ومع ذلك، فإن توزيع Compose
كمكتبة يتطلب تكلفة.
يتم تجميع رمز نظام Android الأساسي وتثبيته على الجهاز.
ومع ذلك، يجب تحميل المكتبات عند تشغيل التطبيق وتفسير عملية التجميع أثناء التشغيل
عند الحاجة. ويمكن أن يؤدي ذلك إلى إبطاء التطبيق عند بدء التشغيل وعند استخدامه إحدى ميزات المكتبة لأول مرة.
مزايا الملفات الشخصية الأساسية
يمكنك تحسين الأداء من خلال تحديد الملفات الشخصية المرجعية. وتحدِّد هذه الملفات الشخصية الفئات والأساليب اللازمة في تجارب المستخدمين المهمة، ويتم توزيعها باستخدام حزمة APK أو AAB الخاصة بالتطبيق. أثناء تثبيت التطبيق، يجمع ART هذا الكود
الحرج AOT بحيث يكون جاهزًا للاستخدام عند تشغيل التطبيق.
لا يكون تعريف الملف الشخصي الأساسي واضحًا دائمًا،
وبسبب ذلك، يتم تضمين Compose بتعريف واحد تلقائيًا. قد لا تضطر إلى القيام بأي
عمل لرؤية هذه الفائدة. ومع ذلك، يحتوي الملف الشخصي الأساسي الذي يتم تضمينه مع Compose فقط على تحسينات للرمز البرمجي داخل مكتبة Compose.
مقياس الأداء الفائق
للاستفادة إلى أقصى حدّ من ميزة التحسين، يمكنك إنشاء ملف شخصي أساسي
لتطبيقك يستخدم مقياس الأداء الرئيسي لتغطية تجارب المستخدمين المهمة. عند تحديد ملفك الشخصي، يجب أن تختبره للتأكّد من أنّه مفيد. وهناك طريقة جيدة لإجراء ذلك وهي كتابة اختبارات مقياس الأداء الفائق لتطبيقك والاطّلاع على نتائج الاختبار أثناء كتابة ملفك الشخصي الأساسي ومراجعته.
للاطّلاع على مثال عن طريقة كتابة اختبارات معيار ماكرو لواجهة المستخدم في Compose، راجِع نموذج ComposeAllowed المستندة إلى معيار ماكرو.
مراجع إضافية
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-07-27 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Use a baseline profile\n\n[Baseline Profiles](/baseline-profiles) improve code execution speed by about 30% from the first\nlaunch by avoiding interpretation and just-in-time (JIT) compilation steps for\nincluded code paths. By shipping a Baseline Profile in an app or library, you\nenable Android Runtime (ART) to optimize included code paths through\nahead-of-time (AOT) compilation, providing performance enhancements for every\nnew app install and every app update. This profile-guided optimization (PGO)\nlets apps optimize startup, reduce interaction jank, and improve overall runtime\nperformance from the first launch for end users.\n\nCompose performance considerations\n----------------------------------\n\nCompose is distributed as a library instead of as part of the Android platform.\nThis approach lets the Compose team update Compose frequently and support a wide\nrange of Android versions. However, distributing Compose as a library imposes a\ncost.\n\nAndroid platform code is already compiled and installed on the device.\nLibraries, however, need to be loaded when the app launches and interpreted JIT\nwhen needed. This can slow the app on startup and when it uses a library feature\nfor the first time.\n\nBenefits of baseline profiles\n-----------------------------\n\nYou can improve performance by defining [Baseline Profiles](/topic/performance/baselineprofiles/overview). These profiles\ndefine classes and methods needed on critical user journeys and are distributed\nwith your app's APK or AAB. During app installation, ART compiles this critical\ncode AOT so that it's ready for use when the app launches.\n\nA good Baseline Profile definition is not always straightforward, and because\nof this, Compose ships with one by default. You might not have to do any work to\nsee this benefit. However, the Baseline Profile that ships with Compose only\ncontains optimizations for the code within the Compose library.\n\n### Macrobenchmark\n\nTo get the best optimization, [create a Baseline Profile](/topic/performance/baselineprofiles/create-baselineprofile)\nfor your app that uses [Macrobenchmark](/studio/profile/macrobenchmark-overview) to cover critical user journeys. When\nyou define your own profile, you must test the profile to verify that it's\nhelping. A good way to do that is to write [Macrobenchmark](/studio/profile/macrobenchmark-overview) tests for your\napp and check the test results as you write and revise your Baseline Profile.\n\nFor an example of how to write Macrobenchmark tests for your Compose UI, see the\n[Macrobenchmark Compose sample](https://github.com/android/performance-samples/tree/main/MacrobenchmarkSample).\n\nAdditional Resources\n--------------------\n\n- **[App performance guide](/topic/performance/overview)**: Discover best practices, libraries, and tools to improve performance on Android.\n- **[Inspect Performance](/topic/performance/inspecting-overview):** Inspect app performance.\n- **[Benchmarking](/topic/performance/benchmarking/benchmarking-overview):** Benchmark app performance.\n- **[App startup](/topic/performance/appstartup/analysis-optimization):** Optimize app startup.\n- **[Baseline profiles](/baseline-profiles):** Understand baseline profiles."]]