-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
feat: update baseline profiles command, update README with new UI prevviews #58
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
212 changes: 106 additions & 106 deletions
212
...ginativeworld/whynotcompose/benchmarks/baselineprofile/AnimationsModuleBaselineProfile.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,106 +1,106 @@ | ||
/* | ||
* Copyright 2024 Md. Mahmudul Hasan Shohag | ||
* | ||
* 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. | ||
* | ||
* ------------------------------------------------------------------------ | ||
* | ||
* Project: Why Not Compose! | ||
* Developed by: @ImaginativeShohag | ||
* | ||
* Md. Mahmudul Hasan Shohag | ||
* [email protected] | ||
* | ||
* Source: https://github.com/ImaginativeShohag/Why-Not-Compose | ||
*/ | ||
|
||
package org.imaginativeworld.whynotcompose.benchmarks.baselineprofile | ||
|
||
import androidx.benchmark.macro.junit4.BaselineProfileRule | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import androidx.test.filters.LargeTest | ||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.uiautomator.By | ||
import org.imaginativeworld.whynotcompose.benchmarks.commonModuleTraverseActions | ||
import org.imaginativeworld.whynotcompose.benchmarks.startActivityAndAllowNotifications | ||
import org.imaginativeworld.whynotcompose.benchmarks.waitAndFindObject | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
/** | ||
* This test class generates a basic startup baseline profile for the target package. | ||
* | ||
* We recommend you start with this but add important user flows to the profile to improve their performance. | ||
* Refer to the [baseline profile documentation](https://d.android.com/topic/performance/baselineprofiles) | ||
* for more information. | ||
* | ||
* You can run the generator with the "Generate Baseline Profile" run configuration in Android Studio or | ||
* the equivalent `generateBaselineProfile` gradle task: | ||
* ``` | ||
* ./gradlew :app:generateReleaseBaselineProfile | ||
* ``` | ||
* The run configuration runs the Gradle task and applies filtering to run only the generators. | ||
* | ||
* Check [documentation](https://d.android.com/topic/performance/benchmarking/macrobenchmark-instrumentation-args) | ||
* for more information about available instrumentation arguments. | ||
* | ||
* After you run the generator, you can verify the improvements running the [org.imaginativeworld.whynotcompose.benchmarks.startup.StartupBenchmarks] benchmark. | ||
* | ||
* When using this class to generate a baseline profile, only API 33+ or rooted API 28+ are supported. | ||
* | ||
* The minimum required version of androidx.benchmark to generate a baseline profile is 1.2.0. | ||
**/ | ||
@RunWith(AndroidJUnit4::class) | ||
@LargeTest | ||
class AnimationsModuleBaselineProfile { | ||
|
||
@get:Rule | ||
val rule = BaselineProfileRule() | ||
|
||
@Test | ||
fun generate() { | ||
// The application id for the running build variant is read from the instrumentation arguments. | ||
rule.collect( | ||
packageName = InstrumentationRegistry.getArguments().getString("targetAppId") | ||
?: throw Exception("targetAppId not passed as instrumentation runner arg"), | ||
|
||
// See: https://d.android.com/topic/performance/baselineprofiles/dex-layout-optimizations | ||
includeInStartupProfile = true | ||
) { | ||
// This block defines the app's critical user journey. Here we are interested in | ||
// optimizing for app startup. But you can also navigate and scroll through your most important UI. | ||
|
||
// Start default activity for your app | ||
pressHome() | ||
startActivityAndAllowNotifications() | ||
|
||
// TODO Write more interactions to optimize advanced journeys of your app. | ||
// For example: | ||
// 1. Wait until the content is asynchronously loaded | ||
// 2. Scroll the feed content | ||
// 3. Navigate to detail screen | ||
|
||
// Check UiAutomator documentation for more information how to interact with the app. | ||
// https://d.android.com/training/testing/other-components/ui-automator | ||
|
||
// Wait for home screen | ||
device.waitAndFindObject(By.res("screen:home"), 5_000) | ||
|
||
commonModuleTraverseActions( | ||
moduleButtonText = "Animations", | ||
screenTag = "screen:animations:index" | ||
) | ||
} | ||
} | ||
} | ||
// /* | ||
// * Copyright 2024 Md. Mahmudul Hasan Shohag | ||
// * | ||
// * 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. | ||
// * | ||
// * ------------------------------------------------------------------------ | ||
// * | ||
// * Project: Why Not Compose! | ||
// * Developed by: @ImaginativeShohag | ||
// * | ||
// * Md. Mahmudul Hasan Shohag | ||
// * [email protected] | ||
// * | ||
// * Source: https://github.com/ImaginativeShohag/Why-Not-Compose | ||
// */ | ||
// | ||
// package org.imaginativeworld.whynotcompose.benchmarks.baselineprofile | ||
// | ||
// import androidx.benchmark.macro.junit4.BaselineProfileRule | ||
// import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
// import androidx.test.filters.LargeTest | ||
// import androidx.test.platform.app.InstrumentationRegistry | ||
// import androidx.test.uiautomator.By | ||
// import org.imaginativeworld.whynotcompose.benchmarks.commonModuleTraverseActions | ||
// import org.imaginativeworld.whynotcompose.benchmarks.startActivityAndAllowNotifications | ||
// import org.imaginativeworld.whynotcompose.benchmarks.waitAndFindObject | ||
// import org.junit.Rule | ||
// import org.junit.Test | ||
// import org.junit.runner.RunWith | ||
// | ||
// /** | ||
// * This test class generates a basic startup baseline profile for the target package. | ||
// * | ||
// * We recommend you start with this but add important user flows to the profile to improve their performance. | ||
// * Refer to the [baseline profile documentation](https://d.android.com/topic/performance/baselineprofiles) | ||
// * for more information. | ||
// * | ||
// * You can run the generator with the "Generate Baseline Profile" run configuration in Android Studio or | ||
// * the equivalent `generateBaselineProfile` gradle task: | ||
// * ``` | ||
// * ./gradlew :app:generateReleaseBaselineProfile | ||
// * ``` | ||
// * The run configuration runs the Gradle task and applies filtering to run only the generators. | ||
// * | ||
// * Check [documentation](https://d.android.com/topic/performance/benchmarking/macrobenchmark-instrumentation-args) | ||
// * for more information about available instrumentation arguments. | ||
// * | ||
// * After you run the generator, you can verify the improvements running the [org.imaginativeworld.whynotcompose.benchmarks.startup.StartupBenchmarks] benchmark. | ||
// * | ||
// * When using this class to generate a baseline profile, only API 33+ or rooted API 28+ are supported. | ||
// * | ||
// * The minimum required version of androidx.benchmark to generate a baseline profile is 1.2.0. | ||
// **/ | ||
// @RunWith(AndroidJUnit4::class) | ||
// @LargeTest | ||
// class AnimationsModuleBaselineProfile { | ||
// | ||
// @get:Rule | ||
// val rule = BaselineProfileRule() | ||
// | ||
// @Test | ||
// fun generate() { | ||
// // The application id for the running build variant is read from the instrumentation arguments. | ||
// rule.collect( | ||
// packageName = InstrumentationRegistry.getArguments().getString("targetAppId") | ||
// ?: throw Exception("targetAppId not passed as instrumentation runner arg"), | ||
// | ||
// // See: https://d.android.com/topic/performance/baselineprofiles/dex-layout-optimizations | ||
// includeInStartupProfile = true | ||
// ) { | ||
// // This block defines the app's critical user journey. Here we are interested in | ||
// // optimizing for app startup. But you can also navigate and scroll through your most important UI. | ||
// | ||
// // Start default activity for your app | ||
// pressHome() | ||
// startActivityAndAllowNotifications() | ||
// | ||
// // TODO Write more interactions to optimize advanced journeys of your app. | ||
// // For example: | ||
// // 1. Wait until the content is asynchronously loaded | ||
// // 2. Scroll the feed content | ||
// // 3. Navigate to detail screen | ||
// | ||
// // Check UiAutomator documentation for more information how to interact with the app. | ||
// // https://d.android.com/training/testing/other-components/ui-automator | ||
// | ||
// // Wait for home screen | ||
// device.waitAndFindObject(By.res("screen:home"), 5_000) | ||
// | ||
// commonModuleTraverseActions( | ||
// moduleButtonText = "Animations", | ||
// screenTag = "screen:animations:index" | ||
// ) | ||
// } | ||
// } | ||
// } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [ktlint] standard:no-empty-file reported by reviewdog 🐶
File 'AnimationsModuleBaselineProfile.kt' should not be empty