Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created BaselineProfile for app performance improvement support #732

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13,577 changes: 13,577 additions & 0 deletions app-android/src/main/baseline-prof.txt

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions benchmark/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ dependencies {
implementation(libs.androidxTestEspressoEspressoCore)
implementation(libs.androidxTestUiAutomator)
implementation(libs.androidxMacroBenchmark)
implementation(libs.androidxProfileinstaller)
}

androidComponents {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package io.github.droidkaigi.confsched2022.baselineprofile

import androidx.benchmark.macro.ExperimentalBaselineProfilesApi
import androidx.benchmark.macro.junit4.BaselineProfileRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.uiautomator.By
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

@ExperimentalBaselineProfilesApi
@RunWith(AndroidJUnit4::class)
class BaselineProfileGenerator {

@get:Rule val baselineProfileRule = BaselineProfileRule()

@Test
fun startup() =
baselineProfileRule.collectBaselineProfile(
packageName = "io.github.droidkaigi.confsched2022.dev"
) {
pressHome()
startActivityAndWait()
device.waitForIdle()

device.run {
device.findObject(By.res("sessionDayTab")).click()
waitForIdle()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTag
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import io.github.droidkaigi.confsched2022.designsystem.theme.montserratFonts
import io.github.droidkaigi.confsched2022.model.DroidKaigi2022Day
import io.github.droidkaigi.confsched2022.model.DroidKaigi2022Day.Day2

@Composable
internal fun SessionDayTab(
Expand All @@ -38,7 +41,11 @@ internal fun SessionDayTab(
Tab(
selected = selected,
onClick = { onTabClicked(index) },
modifier = Modifier.height(height).padding(end = 8.dp).clip(CircleShape)
modifier = Modifier.height(height).padding(end = 8.dp).clip(CircleShape).semantics {
if (day == Day2) {
testTag = "sessionDayTab"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
I think this makes code change a little difficult. Day2 is not only day tab.
I think we don't have to switch tab at the moment. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry. I am late in noticing your comment 🙇
I didn't understand about other influences..
So, remove the semantics movement and try again 👍

}
}
) {
Column(
modifier = Modifier.fillMaxSize(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.platform.LocalLayoutDirection
Expand All @@ -53,6 +54,7 @@ import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.semantics.customActions
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTag
import androidx.compose.ui.semantics.testTagsAsResourceId
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.zIndex
Expand Down Expand Up @@ -395,7 +397,7 @@ fun SessionsList(

data class DurationTime(val startAt: String, val endAt: String)

@OptIn(ExperimentalPagerApi::class)
@OptIn(ExperimentalPagerApi::class, ExperimentalComposeUiApi::class)
@Composable
fun SessionsTopBar(
pagerContentsScrollState: PagerContentsScrollState,
Expand Down Expand Up @@ -466,7 +468,7 @@ fun SessionsTopBar(
.padding(16.dp)
.windowInsetsPadding(
WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal)
),
).semantics { testTagsAsResourceId = true },
containerColor = MaterialTheme.colorScheme
.surfaceColorAtElevation(2.dp),
indicator = {
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ androidxTestExt = "1.1.3"
androidxTestEspresso = "3.4.0"
androidxTestUiAutomator = "2.2.0"
androidxMacroBenchmark = "1.2.0-alpha04"
androidxProfileinstaller = "1.2.0-beta01"
dagger = "2.44"
spotless = "6.7.0"
ktlint = "0.45.2"
Expand Down Expand Up @@ -151,6 +152,7 @@ androidxTestExtJunit = { module = "androidx.test.ext:junit", version.ref = "andr
androidxTestEspressoEspressoCore = { module = "androidx.test.espresso:espresso-core", version.ref = "androidxTestEspresso" }
androidxTestUiAutomator = {module = "androidx.test.uiautomator:uiautomator", version.ref = "androidxTestUiAutomator"}
androidxMacroBenchmark = { module = "androidx.benchmark:benchmark-macro-junit4", version.ref = "androidxMacroBenchmark" }
androidxProfileinstaller = { group = "androidx.profileinstaller", name = "profileinstaller", version.ref = "androidxProfileinstaller" }
hiltAndroidTesting = { group = "com.google.dagger", name = "hilt-android-testing", version.ref = "dagger" }
robolectric = { module = "org.robolectric:robolectric", version.ref = "robolectric" }
kluentAndroid = { module = "org.amshove.kluent:kluent-android", version.ref = "kluent" }
Expand Down