Skip to content

Commit

Permalink
Run 3 AnalysisFormatBenchmark in Parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
Friendseeker committed Sep 26, 2024
1 parent 95edec7 commit 2ef3dd9
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 23 deletions.
43 changes: 34 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ jobs:
- os: ubuntu-latest
java: 21
jobtype: 6
- os: ubuntu-latest
java: 21
jobtype: 7
- os: ubuntu-latest
java: 21
jobtype: 8
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
Expand Down Expand Up @@ -67,29 +73,48 @@ jobs:
shell: bash
run: |
sbt -v -Dfile.encoding=UTF-8 "-Dbenchmark.pattern=.*Shapeless.*" "runBenchmarks"
- name: Benchmark (AnalysisFormatBenchmark) (6)
- name: Benchmark (CompilerSerializationBenchmark) (6)
if: ${{ matrix.jobtype == 6 }}
shell: bash
run: |
sbt -v -Dfile.encoding=UTF-8 "-Dbenchmark.pattern=.*AnalysisFormatBenchmark.*" "zincBenchmarks/Jmh/clean" "runBenchmarks"
- name: Checkout Target Branch (4, 5)
if: ${{ github.event_name == 'pull_request' && (matrix.jobtype == 4 || matrix.jobtype == 5) }}
sbt -v -Dfile.encoding=UTF-8 "-Dbenchmark.pattern=.*Compiler.*" "runBenchmarks"
- name: Benchmark (LibrarySerializationBenchmark) (7)
if: ${{ matrix.jobtype == 7 }}
shell: bash
run: |
sbt -v -Dfile.encoding=UTF-8 "-Dbenchmark.pattern=.*Library.*" "runBenchmarks"
- name: Benchmark (ReflectSerializationBenchmark) (8)
if: ${{ matrix.jobtype == 8 }}
shell: bash
run: |
sbt -v -Dfile.encoding=UTF-8 "-Dbenchmark.pattern=.*Reflect.*" "runBenchmarks"
- name: Checkout Target Branch (4-8)
if: ${{ github.event_name == 'pull_request' && matrix.jobtype >= 4 && matrix.jobtype <= 8 }}
uses: actions/checkout@v4
with:
clean: false
ref: ${{ github.event.pull_request.base.ref }}
- name: Benchmark (Scalac) against Target Branch (4)
if: ${{ github.event_name == 'pull_request' && matrix.jobtype == 4 }}
shell: bash
run: |
sbt -v -Dfile.encoding=UTF-8 "-Dbenchmark.pattern=.*Scalac.*" "zincBenchmarks/Jmh/clean" "runBenchmarks"
sbt -v -Dfile.encoding=UTF-8 "-Dbenchmark.pattern=.*Scalac.*" "runBenchmarks"
- name: Benchmark (Shapeless) against Target Branch (5)
if: ${{ github.event_name == 'pull_request' && matrix.jobtype == 5 }}
shell: bash
run: |
sbt -v -Dfile.encoding=UTF-8 "-Dbenchmark.pattern=.*Shapeless.*" "zincBenchmarks/Jmh/clean" "runBenchmarks"
- name: Benchmark (AnalysisFormatBenchmark) against Target Branch (6)
sbt -v -Dfile.encoding=UTF-8 "-Dbenchmark.pattern=.*Shapeless.*" "runBenchmarks"
- name: Benchmark (CompilerSerializationBenchmark) against Target Branch (6)
if: ${{ matrix.jobtype == 6 }}
shell: bash
run: |
sbt -v -Dfile.encoding=UTF-8 "-Dbenchmark.pattern=.*AnalysisFormatBenchmark.*" "zincBenchmarks/Jmh/clean" "runBenchmarks"
sbt -v -Dfile.encoding=UTF-8 "-Dbenchmark.pattern=.*Compiler.*" "runBenchmarks"
- name: Benchmark (LibrarySerializationBenchmark) against Target Branch (7)
if: ${{ matrix.jobtype == 7 }}
shell: bash
run: |
sbt -v -Dfile.encoding=UTF-8 "-Dbenchmark.pattern=.*Library.*" "runBenchmarks"
- name: Benchmark (ReflectSerializationBenchmark) against Target Branch (8)
if: ${{ matrix.jobtype == 8 }}
shell: bash
run: |
sbt -v -Dfile.encoding=UTF-8 "-Dbenchmark.pattern=.*Reflect.*" "runBenchmarks"
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,21 @@ import sbt.io.IO
import xsbti.compile.analysis.ReadWriteMappers
import xsbti.compile.{ AnalysisContents, AnalysisStore }

@BenchmarkMode(Array(Mode.AverageTime))
@Fork(1)
@Threads(1)
@Warmup(iterations = 5)
@Measurement(iterations = 5)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@State(Scope.Benchmark)
class AnalysisFormatBenchmark {

var temp: File = _
val sets = IndexedSeq("compiler", "reflect", "library")
var binaryFileName: String = _
var cached: Map[String, AnalysisContents] = _

@Setup
def setup(): Unit = {
this.temp = IO.createTemporaryDirectory
sets.foreach { s =>
val f = new File("../../../test-data", s"${s}.zip")
assert(f.exists())
val f2 = new File(temp, f.getName)
IO.copyFile(f, f2)
assert(f2.exists())
}
val f = new File("../../../test-data", s"${binaryFileName}.zip")
assert(f.exists())
val f2 = new File(temp, f.getName)
IO.copyFile(f, f2)
assert(f2.exists())
this.cached = readAll("", FileAnalysisStore.binary(_))
writeAll("-ref-text", FileAnalysisStore.text(_), cached)
// writeAll("-ref-ctext", ConsistentFileAnalysisStore.text(_, ReadWriteMappers.getEmptyMappers), cached)
Expand Down Expand Up @@ -174,3 +166,33 @@ class NullSerializer extends Serializer {
def long(l: Long): Unit = _count += 1
def end(): Unit = _count += 1
}

@BenchmarkMode(Array(Mode.AverageTime))
@Fork(1)
@Threads(1)
@Warmup(iterations = 5)
@Measurement(iterations = 5)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
class CompilerSerializationBenchmark extends AnalysisFormatBenchmark {
binaryFileName = "compiler"
}

@BenchmarkMode(Array(Mode.AverageTime))
@Fork(1)
@Threads(1)
@Warmup(iterations = 5)
@Measurement(iterations = 5)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
class LibrarySerializationBenchmark extends AnalysisFormatBenchmark {
binaryFileName = "library"
}

@BenchmarkMode(Array(Mode.AverageTime))
@Fork(1)
@Threads(1)
@Warmup(iterations = 5)
@Measurement(iterations = 5)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
class ReflectSerializationBenchmark extends AnalysisFormatBenchmark {
binaryFileName = "reflect"
}

0 comments on commit 2ef3dd9

Please sign in to comment.