From bf15e32c18cb4e56faa678bef43a5d1f30370305 Mon Sep 17 00:00:00 2001 From: Amany ElSayed <128927527+CodingPanda166@users.noreply.github.com> Date: Mon, 23 Mar 2026 22:17:39 +0200 Subject: [PATCH 1/4] Modify Android benchmark workflow configuration Updated API level and emulator memory settings for benchmarks. --- .github/workflows/Build.yaml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Build.yaml b/.github/workflows/Build.yaml index 31b274d7f..eb369b4b5 100644 --- a/.github/workflows/Build.yaml +++ b/.github/workflows/Build.yaml @@ -2,16 +2,32 @@ name: Benchmark on Emulator on: workflow_dispatch: + # schedule: + # - cron: "0 2,10,18 * * *" jobs: benchmark-android: + strategy: + fail-fast: false + matrix: + benchmark: + #- name: startup + #args: "-e class com.google.samples.apps.nowinandroid.startup.StartupBenchmark#startupWithPartialCompilationAndDisabledBaselineProfile" + #- name: scrollforyou-frametime + #args: "-e class com.google.samples.apps.nowinandroid.foryou.ScrollForYouFeedBenchmark#scrollFeedCompilationBaselineProfile" + - name: scrollforyou-memory-max + args: "-e class com.google.samples.apps.nowinandroid.foryou.ScrollForYouFeedBenchmark#scrollFeedCompilationMemoryMaxBaselineProfile" + name: ${{ matrix.benchmark.name }} uses: Frozen-Bytes/actions/.github/workflows/android-macrobenchmark-gradle.yml@main with: - api-level: 31 + api-level: 34 target: google_apis arch: x86_64 force-avd-creation: true - emulator-options: -no-snapshot -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -memory 4096 + emulator-options: -no-snapshot -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -memory 8192 -cores 4 disable-animations: true gradle-cache-readonly: false - instrument-args: "-e class com.google.samples.apps.nowinandroid.startup.StartupBenchmark#startupPrecompiledWithBaselineProfile" + instrument-args: ${{ matrix.benchmark.args }} + runs: 5 + benchcomp-args: "--verbose --all-methods --all-measures --aggregate median" + artifact-name: "benchmark-${{ matrix.benchmark.name }}" From ba89c1ae5bc1e9736923376516c1ad0f4a45999d Mon Sep 17 00:00:00 2001 From: Amany ElSayed <128927527+CodingPanda166@users.noreply.github.com> Date: Mon, 23 Mar 2026 22:32:49 +0200 Subject: [PATCH 2/4] Modify benchmark configuration in Build.yaml Updated API level and emulator memory settings for benchmarks. --- .github/workflows/Build.yaml | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/.github/workflows/Build.yaml b/.github/workflows/Build.yaml index eb369b4b5..31b274d7f 100644 --- a/.github/workflows/Build.yaml +++ b/.github/workflows/Build.yaml @@ -2,32 +2,16 @@ name: Benchmark on Emulator on: workflow_dispatch: - # schedule: - # - cron: "0 2,10,18 * * *" jobs: benchmark-android: - strategy: - fail-fast: false - matrix: - benchmark: - #- name: startup - #args: "-e class com.google.samples.apps.nowinandroid.startup.StartupBenchmark#startupWithPartialCompilationAndDisabledBaselineProfile" - #- name: scrollforyou-frametime - #args: "-e class com.google.samples.apps.nowinandroid.foryou.ScrollForYouFeedBenchmark#scrollFeedCompilationBaselineProfile" - - name: scrollforyou-memory-max - args: "-e class com.google.samples.apps.nowinandroid.foryou.ScrollForYouFeedBenchmark#scrollFeedCompilationMemoryMaxBaselineProfile" - name: ${{ matrix.benchmark.name }} uses: Frozen-Bytes/actions/.github/workflows/android-macrobenchmark-gradle.yml@main with: - api-level: 34 + api-level: 31 target: google_apis arch: x86_64 force-avd-creation: true - emulator-options: -no-snapshot -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -memory 8192 -cores 4 + emulator-options: -no-snapshot -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -memory 4096 disable-animations: true gradle-cache-readonly: false - instrument-args: ${{ matrix.benchmark.args }} - runs: 5 - benchcomp-args: "--verbose --all-methods --all-measures --aggregate median" - artifact-name: "benchmark-${{ matrix.benchmark.name }}" + instrument-args: "-e class com.google.samples.apps.nowinandroid.startup.StartupBenchmark#startupPrecompiledWithBaselineProfile" From ccfbc8f2a134fe8ed0f3fbe0699e3bfa804aa5f3 Mon Sep 17 00:00:00 2001 From: Tony Medhat Date: Thu, 9 Apr 2026 10:19:17 +0200 Subject: [PATCH 3/4] feat: add a rebase helper script --- scripts/sync-benchmark-bases.sh | 79 +++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100755 scripts/sync-benchmark-bases.sh diff --git a/scripts/sync-benchmark-bases.sh b/scripts/sync-benchmark-bases.sh new file mode 100755 index 000000000..fc0dbfdcd --- /dev/null +++ b/scripts/sync-benchmark-bases.sh @@ -0,0 +1,79 @@ +#!/usr/bin/env bash +# +# This script automates the process of updating benchmark branches against a +# new base (usually 'main'). It iterates through a predefined list of +# "old" benchmark branches and performs a git rebase for each. +# +# By default, the script runs in DRY_RUN mode. Use -f or --force to +# execute the actual git commands. + +set -euo pipefail + +readonly OLD_BASES=( + # Normal branches (No Regression) + "bench-startup-normal" + "bench-scrollforyou-normal" + "bench-scrollforyou-mem-normal" + + # Regression branches + "bench-startup-reg" + "bench-scrollforyou-reg" + "bench-scrollforyou-mem-reg" +) + +NEW_BASE="main" + +DRY_RUN=true + +print_usage() { + cat < Specify the base branch to rebase onto (default: $NEW_BASE) +EOF +} + +while [[ $# -gt 0 ]]; do + case "$1" in + -h | --help) + print_usage + exit 0 + ;; + -f | --force) + DRY_RUN=false + shift + ;; + --new-base) + NEW_BASE="$2" + shift 2 + ;; + *) + echo "$(basename "$0"): invalid option -- '$1'" + echo "Try '$(basename "$0") --help' for more information" + exit 1 + ;; + esac +done + +if "${DRY_RUN}"; then + echo "info: running in dry run mode, the following commands will not be executed" + echo "info: use -f or --force to execute the actual git commands" +fi + +for BASE in "${OLD_BASES[@]}"; do + if ${DRY_RUN}; then + echo "dry: git checkout ${BASE}" + echo "dry: git merge ${NEW_BASE}" + else + echo "git checkout ${BASE}" + git checkout "${BASE}" + + echo "git merge ${NEW_BASE}" + git merge "${NEW_BASE}" + fi +done From 851334031f8fdbe42587e8b86772e4032eeb2d7c Mon Sep 17 00:00:00 2001 From: Tony Medhat Date: Thu, 9 Apr 2026 10:19:59 +0200 Subject: [PATCH 4/4] bench: set iteration count for all benchmarks to 5 iterations instead of 10 --- .../apps/nowinandroid/foryou/ScrollForYouFeedBenchmark.kt | 4 ++-- .../apps/nowinandroid/interests/ScrollTopicListBenchmark.kt | 2 +- .../interests/TopicsScreenRecompositionBenchmark.kt | 2 +- .../samples/apps/nowinandroid/startup/StartupBenchmark.kt | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/foryou/ScrollForYouFeedBenchmark.kt b/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/foryou/ScrollForYouFeedBenchmark.kt index 155f8d40d..e899829a6 100644 --- a/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/foryou/ScrollForYouFeedBenchmark.kt +++ b/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/foryou/ScrollForYouFeedBenchmark.kt @@ -47,7 +47,7 @@ class ScrollForYouFeedBenchmark { packageName = PACKAGE_NAME, metrics = listOf(FrameTimingMetric()), compilationMode = compilationMode, - iterations = 10, + iterations = 5, startupMode = StartupMode.WARM, setupBlock = { // Start the app @@ -68,7 +68,7 @@ class ScrollForYouFeedBenchmark { packageName = PACKAGE_NAME, metrics = listOf(MemoryUsageMetric(MemoryUsageMetric.Mode.Max)), compilationMode = compilationMode, - iterations = 10, + iterations = 5, startupMode = StartupMode.WARM, setupBlock = { // Start the app diff --git a/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/interests/ScrollTopicListBenchmark.kt b/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/interests/ScrollTopicListBenchmark.kt index b53e2e05c..4be72783b 100644 --- a/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/interests/ScrollTopicListBenchmark.kt +++ b/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/interests/ScrollTopicListBenchmark.kt @@ -42,7 +42,7 @@ class ScrollTopicListBenchmark { packageName = PACKAGE_NAME, metrics = listOf(FrameTimingMetric()), compilationMode = compilationMode, - iterations = 10, + iterations = 5, startupMode = StartupMode.WARM, setupBlock = { // Start the app diff --git a/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/interests/TopicsScreenRecompositionBenchmark.kt b/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/interests/TopicsScreenRecompositionBenchmark.kt index faf0803f3..43b2ecec1 100644 --- a/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/interests/TopicsScreenRecompositionBenchmark.kt +++ b/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/interests/TopicsScreenRecompositionBenchmark.kt @@ -42,7 +42,7 @@ class TopicsScreenRecompositionBenchmark { packageName = PACKAGE_NAME, metrics = listOf(FrameTimingMetric()), compilationMode = compilationMode, - iterations = 10, + iterations = 5, startupMode = StartupMode.WARM, setupBlock = { // Start the app diff --git a/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/startup/StartupBenchmark.kt b/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/startup/StartupBenchmark.kt index 2067a23c2..c979beeba 100644 --- a/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/startup/StartupBenchmark.kt +++ b/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/startup/StartupBenchmark.kt @@ -61,7 +61,7 @@ class StartupBenchmark { metrics = BaselineProfileMetrics.allMetrics, compilationMode = compilationMode, // More iterations result in higher statistical significance. - iterations = 10, + iterations = 5, startupMode = COLD, setupBlock = { pressHome()