Conversation
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
There was a problem hiding this comment.
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_composeandfastScroll_viewbenchmark tests to measure scrolling performance - Splits the monolithic
ComposeViewBenchmarks.ktinto separateComposeBenchmarks.ktandViewBenchmarks.ktclasses - Extracts shared utilities into
BenchmarkUtils.ktfor 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.
| 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) | ||
| } | ||
| } |
There was a problem hiding this comment.
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.
| ## 🧩 Repository Structure | ||
|
|
||
| ``` | ||
| ```/ |
There was a problem hiding this comment.
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.
| ```/ |
| 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) | ||
| } | ||
| } |
There was a problem hiding this comment.
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.
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