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() 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