Add separate Compose macrobenchmark target
Bug: 172659078
Test: Tests in androidx.compose.integration.macrobenchmark
Now Compose/View have vaguely comparable benchmarks
(TrivialStartupBenchmark, SmallListStartupBenchmark). Note that R8 is
not yet enabled, and iteration counts are still low.
Functionality in Compose benchmarks doesn't yet match View equivalents
1-1, e.g. using string resources, or in list case, presence of
constraints or complexity of item layout.
Change-Id: I99370aebfba223de5ab342ddf56d082c8c782b2f
diff --git a/benchmark/integration-tests/macrobenchmark-target/src/main/AndroidManifest.xml b/benchmark/integration-tests/macrobenchmark-target/src/main/AndroidManifest.xml
index f103e683..58d1f37 100644
--- a/benchmark/integration-tests/macrobenchmark-target/src/main/AndroidManifest.xml
+++ b/benchmark/integration-tests/macrobenchmark-target/src/main/AndroidManifest.xml
@@ -13,16 +13,20 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
package="androidx.benchmark.integration.macrobenchmark.target">
<application
+ android:label="Jetpack Benchmark Macrobenchmark Target"
android:allowBackup="false"
android:supportsRtl="true"
- android:theme="@style/Theme.AppCompat">
+ android:theme="@style/Theme.AppCompat"
+ tools:ignore="MissingApplicationIcon">
<!--
- The activity needs to be exported so the Macro Benchmark Sample can discover activities
+ Activities need to be exported so the macrobenchmark can discover them
under the new package visibility changes for Android 11.
-->
<activity
diff --git a/benchmark/integration-tests/macrobenchmark-target/src/main/java/androidx/benchmark/integration/macrobenchmark/target/RecyclerViewActivity.kt b/benchmark/integration-tests/macrobenchmark-target/src/main/java/androidx/benchmark/integration/macrobenchmark/target/RecyclerViewActivity.kt
index bb07d9f..f5d6a2a 100644
--- a/benchmark/integration-tests/macrobenchmark-target/src/main/java/androidx/benchmark/integration/macrobenchmark/target/RecyclerViewActivity.kt
+++ b/benchmark/integration-tests/macrobenchmark-target/src/main/java/androidx/benchmark/integration/macrobenchmark/target/RecyclerViewActivity.kt
@@ -33,10 +33,8 @@
recycler.adapter = adapter
}
- private fun entries(size: Int): List<Entry> {
- return IntRange(0, size).map {
- Entry("Item $it")
- }
+ private fun entries(size: Int) = List(size) {
+ Entry("Item $it")
}
companion object {
diff --git a/buildSrc/src/main/kotlin/androidx/build/dependencyTracker/AffectedModuleDetector.kt b/buildSrc/src/main/kotlin/androidx/build/dependencyTracker/AffectedModuleDetector.kt
index 4d7315f..beaed73 100644
--- a/buildSrc/src/main/kotlin/androidx/build/dependencyTracker/AffectedModuleDetector.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/dependencyTracker/AffectedModuleDetector.kt
@@ -486,17 +486,17 @@
":compose:material:material"
),
setOf(
- ":benchmark:integration-tests:macrobenchmark",
- ":benchmark:integration-tests:macrobenchmark-target"
- ),
- setOf(
":benchmark:benchmark-macro",
":benchmark:integration-tests:macrobenchmark-target"
- ),
+ ), // link benchmark-macro's correctness test and its target
+ setOf(
+ ":benchmark:integration-tests:macrobenchmark",
+ ":benchmark:integration-tests:macrobenchmark-target"
+ ), // link benchmark's macrobenchmark and its target
setOf(
":compose:integration-tests:macrobenchmark",
- ":compose:integration-tests:demos"
- ),
+ ":compose:integration-tests:macrobenchmark-target"
+ ), // link compose's macrobenchmark and its target
)
}
}
diff --git a/compose/integration-tests/macrobenchmark-target/build.gradle b/compose/integration-tests/macrobenchmark-target/build.gradle
new file mode 100644
index 0000000..7666c45
--- /dev/null
+++ b/compose/integration-tests/macrobenchmark-target/build.gradle
@@ -0,0 +1,30 @@
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+
+import static androidx.build.dependencies.DependenciesKt.*
+
+plugins {
+ id("AndroidXPlugin")
+ id("AndroidXUiPlugin")
+ id("com.android.application")
+ id("org.jetbrains.kotlin.android")
+}
+
+dependencies {
+ kotlinPlugin project(":compose:compiler:compiler")
+
+ implementation(KOTLIN_STDLIB)
+
+ implementation project(":compose:foundation:foundation-layout")
+ implementation project(":compose:material:material")
+ implementation project(":compose:runtime:runtime")
+ implementation project(":compose:ui:ui")
+ implementation project(":compose:ui:ui-tooling")
+}
+
+android.defaultConfig.minSdkVersion 21
+
+tasks.withType(KotlinCompile).configureEach {
+ kotlinOptions {
+ useIR = true
+ }
+}
diff --git a/compose/integration-tests/macrobenchmark-target/src/main/AndroidManifest.xml b/compose/integration-tests/macrobenchmark-target/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..baca019
--- /dev/null
+++ b/compose/integration-tests/macrobenchmark-target/src/main/AndroidManifest.xml
@@ -0,0 +1,53 @@
+<!--
+ ~ Copyright (C) 2020 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ package="androidx.compose.integration.macrobenchmark.target">
+
+ <application
+ android:label="Jetpack Compose Macrobenchmark Target"
+ android:allowBackup="false"
+ android:supportsRtl="true"
+ android:icon="@mipmap/ic_launcher"
+ tools:ignore="GoogleAppIndexingWarning">
+
+ <!--
+ Activities need to be exported so the macrobenchmark can discover them
+ under the new package visibility changes for Android 11.
+ -->
+ <activity
+ android:name=".TrivialStartupActivity"
+ android:exported="true">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="androidx.compose.integration.macrobenchmark.target.TRIVIAL_STARTUP_ACTIVITY" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ </activity>
+ <activity
+ android:name=".LazyColumnActivity"
+ android:exported="true">
+ <intent-filter>
+ <action android:name="androidx.compose.integration.macrobenchmark.target.LAZY_COLUMN_ACTIVITY" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ </activity>
+ </application>
+</manifest>
diff --git a/compose/integration-tests/macrobenchmark-target/src/main/ic_launcher-web.png b/compose/integration-tests/macrobenchmark-target/src/main/ic_launcher-web.png
new file mode 100644
index 0000000..88e5f3b
--- /dev/null
+++ b/compose/integration-tests/macrobenchmark-target/src/main/ic_launcher-web.png
Binary files differ
diff --git a/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/LazyColumnActivity.kt b/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/LazyColumnActivity.kt
new file mode 100644
index 0000000..a0461f4
--- /dev/null
+++ b/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/LazyColumnActivity.kt
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.integration.macrobenchmark.target
+
+import android.os.Bundle
+import androidx.activity.ComponentActivity
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.lazy.LazyColumnFor
+import androidx.compose.material.Checkbox
+import androidx.compose.material.Text
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.platform.setContent
+
+class LazyColumnActivity : ComponentActivity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ val itemCount = intent.getIntExtra(EXTRA_ITEM_COUNT, 1000)
+
+ setContent {
+ LazyColumnFor(
+ items = List(itemCount) {
+ Entry("Item $it")
+ },
+ modifier = Modifier.fillMaxWidth(),
+ itemContent = { item ->
+ Row {
+ Text(text = item.contents)
+ Spacer(modifier = Modifier.weight(1f, fill = true))
+ Checkbox(checked = false, onCheckedChange = {})
+ }
+ }
+ )
+ }
+
+ reportFullyDrawn()
+ }
+
+ companion object {
+ const val EXTRA_ITEM_COUNT = "ITEM_COUNT"
+ }
+}
+
+data class Entry(val contents: String)
\ No newline at end of file
diff --git a/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/TrivialStartupActivity.kt b/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/TrivialStartupActivity.kt
new file mode 100644
index 0000000..ca32dc3
--- /dev/null
+++ b/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/TrivialStartupActivity.kt
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.integration.macrobenchmark.target
+
+import android.os.Bundle
+import androidx.activity.ComponentActivity
+import androidx.compose.material.Text
+import androidx.compose.ui.platform.setContent
+
+class TrivialStartupActivity : ComponentActivity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ setContent {
+ Text("Compose Macrobenchmark Target")
+ }
+
+ reportFullyDrawn()
+ }
+}
\ No newline at end of file
diff --git a/compose/integration-tests/macrobenchmark-target/src/main/res/drawable-v24/ic_launcher_foreground.xml b/compose/integration-tests/macrobenchmark-target/src/main/res/drawable-v24/ic_launcher_foreground.xml
new file mode 100644
index 0000000..bbbd1ec
--- /dev/null
+++ b/compose/integration-tests/macrobenchmark-target/src/main/res/drawable-v24/ic_launcher_foreground.xml
@@ -0,0 +1,50 @@
+<!--
+ ~ Copyright 2018 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:aapt="http://schemas.android.com/aapt"
+ android:width="108dp"
+ android:height="108dp"
+ android:viewportHeight="108"
+ android:viewportWidth="108">
+ <path
+ android:fillType="evenOdd"
+ android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
+ android:strokeColor="#00000000"
+ android:strokeWidth="1">
+ <aapt:attr name="android:fillColor">
+ <gradient
+ android:endX="78.5885"
+ android:endY="90.9159"
+ android:startX="48.7653"
+ android:startY="61.0927"
+ android:type="linear">
+ <item
+ android:color="#44000000"
+ android:offset="0.0" />
+ <item
+ android:color="#00000000"
+ android:offset="1.0" />
+ </gradient>
+ </aapt:attr>
+ </path>
+ <path
+ android:fillColor="#FFFFFF"
+ android:fillType="nonZero"
+ android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
+ android:strokeColor="#00000000"
+ android:strokeWidth="1" />
+</vector>
diff --git a/compose/integration-tests/macrobenchmark-target/src/main/res/drawable/ic_launcher_background.xml b/compose/integration-tests/macrobenchmark-target/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 0000000..2aea1e0
--- /dev/null
+++ b/compose/integration-tests/macrobenchmark-target/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright 2018 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<vector
+ android:height="108dp"
+ android:width="108dp"
+ android:viewportHeight="108"
+ android:viewportWidth="108"
+ xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="#008577"
+ android:pathData="M0,0h108v108h-108z"/>
+ <path android:fillColor="#00000000" android:pathData="M9,0L9,108"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M19,0L19,108"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M29,0L29,108"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M39,0L39,108"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M49,0L49,108"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M59,0L59,108"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M69,0L69,108"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M79,0L79,108"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M89,0L89,108"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M99,0L99,108"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M0,9L108,9"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M0,19L108,19"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M0,29L108,29"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M0,39L108,39"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M0,49L108,49"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M0,59L108,59"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M0,69L108,69"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M0,79L108,79"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M0,89L108,89"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M0,99L108,99"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M19,29L89,29"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M19,39L89,39"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M19,49L89,49"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M19,59L89,59"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M19,69L89,69"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M19,79L89,79"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M29,19L29,89"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M39,19L39,89"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M49,19L49,89"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M59,19L59,89"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M69,19L69,89"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M79,19L79,89"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+</vector>
diff --git a/compose/integration-tests/macrobenchmark-target/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/compose/integration-tests/macrobenchmark-target/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..bbd3e02
--- /dev/null
+++ b/compose/integration-tests/macrobenchmark-target/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+ <background android:drawable="@drawable/ic_launcher_background"/>
+ <foreground android:drawable="@drawable/ic_launcher_foreground"/>
+</adaptive-icon>
\ No newline at end of file
diff --git a/compose/integration-tests/macrobenchmark-target/src/main/res/mipmap-hdpi/ic_launcher.png b/compose/integration-tests/macrobenchmark-target/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..898f3ed
--- /dev/null
+++ b/compose/integration-tests/macrobenchmark-target/src/main/res/mipmap-hdpi/ic_launcher.png
Binary files differ
diff --git a/compose/integration-tests/macrobenchmark-target/src/main/res/mipmap-mdpi/ic_launcher.png b/compose/integration-tests/macrobenchmark-target/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..64ba76f
--- /dev/null
+++ b/compose/integration-tests/macrobenchmark-target/src/main/res/mipmap-mdpi/ic_launcher.png
Binary files differ
diff --git a/compose/integration-tests/macrobenchmark-target/src/main/res/mipmap-xhdpi/ic_launcher.png b/compose/integration-tests/macrobenchmark-target/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..e5ed4659
--- /dev/null
+++ b/compose/integration-tests/macrobenchmark-target/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary files differ
diff --git a/compose/integration-tests/macrobenchmark-target/src/main/res/mipmap-xxhdpi/ic_launcher.png b/compose/integration-tests/macrobenchmark-target/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..b0907ca
--- /dev/null
+++ b/compose/integration-tests/macrobenchmark-target/src/main/res/mipmap-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/compose/integration-tests/macrobenchmark-target/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/compose/integration-tests/macrobenchmark-target/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..2c18de9
--- /dev/null
+++ b/compose/integration-tests/macrobenchmark-target/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Binary files differ
diff --git a/compose/integration-tests/macrobenchmark/build.gradle b/compose/integration-tests/macrobenchmark/build.gradle
index 9a6d909a..07444b7 100644
--- a/compose/integration-tests/macrobenchmark/build.gradle
+++ b/compose/integration-tests/macrobenchmark/build.gradle
@@ -40,4 +40,4 @@
// Define a task dependency so the app is installed before we run macro benchmarks.
tasks.getByPath(':compose:integration-tests:macrobenchmark:connectedCheck')
- .dependsOn(tasks.getByPath(':compose:integration-tests:demos:installRelease'))
+ .dependsOn(tasks.getByPath(':compose:integration-tests:macrobenchmark-target:installRelease'))
diff --git a/compose/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml b/compose/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml
index df1de06..82ef367 100644
--- a/compose/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml
+++ b/compose/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml
@@ -19,13 +19,13 @@
<!--
The Macro Benchmark Sample needs to launch activities in
- `androidx.compose.integration.demos` APK.
+ `androidx.compose.integration.macrobenchmark.target` APK.
The Macro Benchmark Library uses `PackageManager` to query for activities. This requires
- the test APK to declare that `androidx.compose.integration.demos` be visible to
+ the test APK to declare that `androidx.compose.integration.macrobenchmark.target` be visible to
the APK (given Android 11's package visibility rules).
-->
<queries>
- <package android:name="androidx.compose.integration.demos" />
+ <package android:name="androidx.compose.integration.macrobenchmark.target" />
</queries>
</manifest>
diff --git a/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/ProcessSpeedProfileValidation.kt b/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/ProcessSpeedProfileValidation.kt
index a9c3920..0fc4cabb 100644
--- a/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/ProcessSpeedProfileValidation.kt
+++ b/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/ProcessSpeedProfileValidation.kt
@@ -56,7 +56,7 @@
}
companion object {
- private const val PACKAGE_NAME = "androidx.compose.integration.demos"
+ private const val PACKAGE_NAME = "androidx.compose.integration.macrobenchmark.target"
@Parameterized.Parameters(name = "compilation_mode={0}, startup_mode={1}")
@JvmStatic
diff --git a/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/StartupDemosMacrobenchmark.kt b/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/SmallListStartupBenchmark.kt
similarity index 62%
rename from compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/StartupDemosMacrobenchmark.kt
rename to compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/SmallListStartupBenchmark.kt
index ace7a4c..34cf7f4 100644
--- a/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/StartupDemosMacrobenchmark.kt
+++ b/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/SmallListStartupBenchmark.kt
@@ -19,39 +19,32 @@
import androidx.benchmark.macro.MacrobenchmarkRule
import androidx.benchmark.macro.StartupMode
import androidx.test.filters.LargeTest
-import androidx.test.filters.SdkSuppress
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
@LargeTest
-@SdkSuppress(minSdkVersion = 29)
-@RunWith(Parameterized::class) // Parameterized to work around timeouts (b/174175784)
-class StartupDemosMacrobenchmark(
- @Suppress("unused") private val ignored: Boolean
-) {
-
+@RunWith(Parameterized::class)
+class SmallListStartupBenchmark(private val startupMode: StartupMode) {
@get:Rule
val benchmarkRule = MacrobenchmarkRule()
@Test
- fun compiledColdStartup() = benchmarkRule.measureStartup(
+ fun startup() = benchmarkRule.measureStartup(
profileCompiled = true,
- startupMode = StartupMode.COLD
- )
-
- @Test
- fun uncompiledColdStartup() = benchmarkRule.measureStartup(
- profileCompiled = false,
- startupMode = StartupMode.COLD
- )
+ startupMode = startupMode
+ ) {
+ action = "androidx.compose.integration.macrobenchmark.target.LAZY_COLUMN_ACTIVITY"
+ putExtra("ITEM_COUNT", 5)
+ }
companion object {
+ @Parameterized.Parameters(name = "mode={0}")
@JvmStatic
- @Parameterized.Parameters
- fun startupDemosParameters(): List<Array<Any>> {
- return listOf(arrayOf(false))
+ fun parameters(): List<Array<Any>> {
+ return listOf(StartupMode.COLD, StartupMode.WARM)
+ .map { arrayOf(it) }
}
}
-}
+}
\ No newline at end of file
diff --git a/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/StartupUtils.kt b/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/StartupUtils.kt
index fe30427..4ef10ad4 100644
--- a/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/StartupUtils.kt
+++ b/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/StartupUtils.kt
@@ -23,7 +23,7 @@
import androidx.benchmark.macro.StartupMode
import androidx.benchmark.macro.StartupTimingMetric
-const val TargetPackage = "androidx.compose.integration.demos"
+const val TargetPackage = "androidx.compose.integration.macrobenchmark.target"
/**
* Simplified interface for standardizing e.g. package,
diff --git a/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/StartupDemosMacrobenchmark.kt b/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/TrivialStartupBenchmark.kt
similarity index 62%
copy from compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/StartupDemosMacrobenchmark.kt
copy to compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/TrivialStartupBenchmark.kt
index ace7a4c..0d92fdc 100644
--- a/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/StartupDemosMacrobenchmark.kt
+++ b/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/TrivialStartupBenchmark.kt
@@ -19,39 +19,31 @@
import androidx.benchmark.macro.MacrobenchmarkRule
import androidx.benchmark.macro.StartupMode
import androidx.test.filters.LargeTest
-import androidx.test.filters.SdkSuppress
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
@LargeTest
-@SdkSuppress(minSdkVersion = 29)
-@RunWith(Parameterized::class) // Parameterized to work around timeouts (b/174175784)
-class StartupDemosMacrobenchmark(
- @Suppress("unused") private val ignored: Boolean
-) {
-
+@RunWith(Parameterized::class)
+class TrivialStartupBenchmark(private val startupMode: StartupMode) {
@get:Rule
val benchmarkRule = MacrobenchmarkRule()
@Test
- fun compiledColdStartup() = benchmarkRule.measureStartup(
+ fun startup() = benchmarkRule.measureStartup(
profileCompiled = true,
- startupMode = StartupMode.COLD
- )
-
- @Test
- fun uncompiledColdStartup() = benchmarkRule.measureStartup(
- profileCompiled = false,
- startupMode = StartupMode.COLD
- )
+ startupMode = startupMode
+ ) {
+ action = "androidx.compose.integration.macrobenchmark.target.TRIVIAL_STARTUP_ACTIVITY"
+ }
companion object {
+ @Parameterized.Parameters(name = "mode={0}")
@JvmStatic
- @Parameterized.Parameters
- fun startupDemosParameters(): List<Array<Any>> {
- return listOf(arrayOf(false))
+ fun parameters(): List<Array<Any>> {
+ return listOf(StartupMode.COLD, StartupMode.WARM, StartupMode.HOT)
+ .map { arrayOf(it) }
}
}
}
diff --git a/settings.gradle b/settings.gradle
index a688c1c..a04f8c7 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -216,6 +216,7 @@
includeProject(":compose:integration-tests:demos:common", "compose/integration-tests/demos/common", [BuildType.COMPOSE])
includeProject(":compose:integration-tests:docs-snippets", "compose/integration-tests/docs-snippets", [BuildType.COMPOSE])
includeProject(":compose:integration-tests:macrobenchmark", "compose/integration-tests/macrobenchmark", [BuildType.COMPOSE])
+includeProject(":compose:integration-tests:macrobenchmark-target", "compose/integration-tests/macrobenchmark-target", [BuildType.COMPOSE])
includeProject(":compose:internal-lint-checks", "compose/internal-lint-checks", [BuildType.COMPOSE])
includeProject(":compose:material", "compose/material", [BuildType.COMPOSE])
includeProject(":compose:material:material", "compose/material/material", [BuildType.COMPOSE])