Skip to content

feat(ANDPERF-5): add fast-scroll benchmarks; split tests & harden runner#14

Open
e-Garcia wants to merge 1 commit intomainfrom
feat/ANDPERF-5_add-compose-and-view-fast-scroll-jank-benchmark-tests
Open

feat(ANDPERF-5): add fast-scroll benchmarks; split tests & harden runner#14
e-Garcia wants to merge 1 commit intomainfrom
feat/ANDPERF-5_add-compose-and-view-fast-scroll-jank-benchmark-tests

Conversation

@e-Garcia
Copy link
Owner

@e-Garcia e-Garcia commented Dec 8, 2025

Add fastScroll_compose and fastScroll_view; split combined tests into ComposeBenchmarks.kt and ViewBenchmarks.kt and extract BenchmarkUtils.kt. Make metric collection robust (convert metric errors into skips), add class-target convenience tasks (runBenchmarkComposeClass, runBenchmarkViewClass), remove nested gradle execs, and update docs.
Generates HTML, JSON and perfetto trace outputs.

Closes #8

Add fastScroll_compose and fastScroll_view; split combined tests into ComposeBenchmarks.kt and ViewBenchmarks.kt and extract BenchmarkUtils.kt.
Make metric collection robust (convert metric errors into skips), add class-target convenience tasks (runBenchmarkComposeClass, runBenchmarkViewClass), remove nested gradle execs, and update docs.
 Generates HTML, JSON and perfetto trace outputs.

 Closes #8
@e-Garcia e-Garcia added this to the 1.0 milestone Dec 8, 2025
@e-Garcia e-Garcia requested a review from Copilot December 8, 2025 05:20
@e-Garcia e-Garcia self-assigned this Dec 8, 2025
@e-Garcia e-Garcia added the enhancement New feature or request label Dec 8, 2025
@e-Garcia e-Garcia linked an issue Dec 8, 2025 that may be closed by this pull request
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds fast-scroll benchmarks for both Compose and View implementations, refactors the benchmark test structure by splitting combined tests into separate classes, and improves the build configuration by removing nested Gradle executions. The changes make metric collection more robust by converting errors into test skips.

  • Adds fastScroll_compose and fastScroll_view benchmark tests to measure scrolling performance
  • Splits the monolithic ComposeViewBenchmarks.kt into separate ComposeBenchmarks.kt and ViewBenchmarks.kt classes
  • Extracts shared utilities into BenchmarkUtils.kt for reusability
  • Replaces Exec tasks with direct task dependencies to avoid spawning nested Gradle processes
  • Adds class-specific convenience tasks (runBenchmarkComposeClass, runBenchmarkViewClass)

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
build.gradle.kts Converts Exec tasks to direct task dependencies, removes nested Gradle calls, adds class-specific benchmark tasks with instrumentation arg configuration
benchmark/build.gradle.kts Moves benchmarkTarget initialization before use, adds targetVariant configuration, sets benchmarkTargetPackage in testInstrumentationRunnerArguments
benchmark/src/main/java/dev/egarcia/andperf/benchmark/ComposeBenchmarks.kt New file containing Compose-specific benchmarks (coldStartup and fastScroll) with package validation and error-to-skip conversion
benchmark/src/main/java/dev/egarcia/andperf/benchmark/ViewBenchmarks.kt New file containing View-specific benchmarks (coldStartup and fastScroll) with package validation and error-to-skip conversion
benchmark/src/main/java/dev/egarcia/andperf/benchmark/BenchmarkUtils.kt New utility class providing shared device access and package installation checking
benchmark/src/main/java/dev/egarcia/andperf/benchmark/ComposeViewBenchmarks.kt Deleted - functionality split into separate ComposeBenchmarks.kt and ViewBenchmarks.kt
benchmark/src/androidTest/java/dev/egarcia/andperf/benchmark/ComposeViewBenchmarks.kt Deleted - functionality moved to main source set
README.md Minor fix to code block syntax in repository structure section

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +50 to +62
measureBlock = {
// perform a series of scroll gestures using UiAutomator helper
val device = BenchmarkUtils.device
val width = device.displayWidth
val height = device.displayHeight
val startX = (width * 0.5).toInt()
val startY = (height * 0.8).toInt()
val endY = (height * 0.2).toInt()
repeat(8) {
device.swipe(startX, startY, startX, endY, 50)
Thread.sleep(150)
}
}
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The fastScroll_compose benchmark uses StartupMode.WARM but doesn't call startActivityAndWait() before performing scroll gestures. In WARM mode, the activity needs to be explicitly started within the measureBlock. Without this call, the swipe gestures will execute against whatever is currently on screen, which may not be the intended app. Consider adding startActivityAndWait() at the beginning of the measureBlock before the scroll gestures.

Copilot uses AI. Check for mistakes.
## 🧩 Repository Structure

```
```/
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The code block fence opening syntax is incorrect. It should be ``` (three backticks) not ```/ (three backticks followed by a slash). The slash makes this invalid markdown syntax.

Suggested change
```/

Copilot uses AI. Check for mistakes.
Comment on lines +48 to +59
measureBlock = {
val device = BenchmarkUtils.device
val width = device.displayWidth
val height = device.displayHeight
val startX = (width * 0.5).toInt()
val startY = (height * 0.8).toInt()
val endY = (height * 0.2).toInt()
repeat(8) {
device.swipe(startX, startY, startX, endY, 50)
Thread.sleep(150)
}
}
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The fastScroll_view benchmark uses StartupMode.WARM but doesn't call startActivityAndWait() before performing scroll gestures. In WARM mode, the activity needs to be explicitly started within the measureBlock. Without this call, the swipe gestures will execute against whatever is currently on screen, which may not be the intended app. Consider adding startActivityAndWait() at the beginning of the measureBlock before the scroll gestures.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(ANDPERF-5): Add Compose and View fast-scroll jank benchmark tests

2 participants