Skip to content

Commit fba0307

Browse files
authored
Merge pull request #1831 from lrytz/bench-smoke-only
Only smoke-test the benchmarks on CI
2 parents 459feef + 5cb2e74 commit fba0307

3 files changed

Lines changed: 9 additions & 41 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,6 @@ jobs:
3030
java: 21
3131
distribution: temurin
3232
jobtype: 4
33-
- os: ubuntu-latest
34-
java: 21
35-
distribution: temurin
36-
jobtype: 5
37-
- os: ubuntu-latest
38-
java: 21
39-
distribution: temurin
40-
jobtype: 6
4133
runs-on: ${{ matrix.os }}
4234
steps:
4335
- name: Checkout
@@ -65,38 +57,8 @@ jobs:
6557
run: |
6658
sbt -v --server -Dfile.encoding=UTF-8 scalafmtCheckRepo headerCheck "Test/headerCheck" generateContrabands
6759
git diff --exit-code
68-
- name: Benchmark (Scalac) (4)
60+
- name: Benchmark smoke test (4)
6961
if: ${{ matrix.jobtype == 4 }}
7062
shell: bash
7163
run: |
72-
sbt -v --server -Dfile.encoding=UTF-8 "-Dbenchmark.pattern=.*Scalac.*" "runBenchmarks"
73-
- name: Benchmark (Shapeless) (5)
74-
if: ${{ matrix.jobtype == 5 }}
75-
shell: bash
76-
run: |
77-
sbt -v --server -Dfile.encoding=UTF-8 "-Dbenchmark.pattern=.*Shapeless.*" "runBenchmarks"
78-
- name: Benchmark (AnalysisFormatBenchmark) (6)
79-
if: ${{ matrix.jobtype == 6 }}
80-
shell: bash
81-
run: |
82-
sbt -v --server -Dfile.encoding=UTF-8 "-Dbenchmark.pattern=.*AnalysisFormatBenchmark.*" "runBenchmarks"
83-
- name: Checkout Target Branch (4-6)
84-
if: ${{ github.event_name == 'pull_request' && (matrix.jobtype >= 4 && matrix.jobtype <= 6) }}
85-
uses: actions/checkout@v7
86-
with:
87-
ref: ${{ github.event.pull_request.base.ref }}
88-
- name: Benchmark (Scalac) against Target Branch (4)
89-
if: ${{ github.event_name == 'pull_request' && matrix.jobtype == 4 }}
90-
shell: bash
91-
run: |
92-
sbt -v --server -Dfile.encoding=UTF-8 "-Dbenchmark.pattern=.*Scalac.*" "runBenchmarks"
93-
- name: Benchmark (Shapeless) against Target Branch (5)
94-
if: ${{ github.event_name == 'pull_request' && matrix.jobtype == 5 }}
95-
shell: bash
96-
run: |
97-
sbt -v --server -Dfile.encoding=UTF-8 "-Dbenchmark.pattern=.*Shapeless.*" "runBenchmarks"
98-
- name: Benchmark (AnalysisFormatBenchmark) against Target Branch (6)
99-
if: ${{ github.event_name == 'pull_request' && matrix.jobtype == 6 }}
100-
shell: bash
101-
run: |
102-
sbt -v --server -Dfile.encoding=UTF-8 "-Dbenchmark.pattern=.*AnalysisFormatBenchmark.*" "runBenchmarks"
64+
sbt -v --server -Dfile.encoding=UTF-8 "-Dbenchmark.jmhOptions=-f 1 -wi 0 -i 1 -w 1s -r 1s" "runBenchmarks"

‎build.sbt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,11 +690,12 @@ addCommandAlias(
690690
"runBenchmarks", {
691691
val dir = IO.createTemporaryDirectory.getAbsolutePath
692692
val pattern = sys.props.getOrElse("benchmark.pattern", "")
693+
val jmhOptions = sys.props.getOrElse("benchmark.jmhOptions", "")
693694
Seq(
694695
s"${compilerBridge213.id}/packageBin",
695696
s"${compilerBridge212.id}/packageBin",
696697
s"${zincBenchmarks.jvm(scala3).id}/Test/run $dir $pattern",
697-
s"${zincBenchmarks.jvm(scala3).id}/Jmh/run -p _tempDir=$dir -prof gc -foe true $pattern",
698+
s"${zincBenchmarks.jvm(scala3).id}/Jmh/run -p _tempDir=$dir -prof gc -foe true $jmhOptions $pattern",
698699
s"""eval IO.delete(file("$dir"))""",
699700
).mkString(";", ";", "")
700701
}

‎contributing-docs/04_benchmark_tests.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ it will run a benchmark for Shapeless, but all benchmarks are welcome to be run
66
on the Scala standard library and other well-known projects in the community,
77
like Akka.
88

9+
`-Dbenchmark.pattern=<regex>` selects benchmarks, and `-Dbenchmark.jmhOptions` passes options to
10+
JMH. CI only checks that every benchmark runs, with
11+
`-Dbenchmark.jmhOptions="-f 1 -wi 0 -i 1 -w 1s -r 1s"`; its numbers mean nothing. Measure
12+
performance locally, comparing against the base branch on the same machine.
13+
914
If you add a new benchmark, make sure that you define the new benchmarking repo
1015
in [BenchmarkProjects.scala](https://github.com/sbt/zinc/blob/d532d15139f9f6e8346c8ffb649e564b25d7e897/internal/zinc-benchmarks/src/main/scala/xsbt/BenchmarkProjects.scala)
1116
and that you define how the benchmarks should be run (have a look at the

0 commit comments

Comments
 (0)