-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import groovy.json.JsonSlurper | ||
import net.steppschuh.markdowngenerator.table.Table | ||
|
||
import java.nio.file.Files | ||
import java.nio.file.Path | ||
|
||
@GrabResolver(name='jitpack.io', root='https://jitpack.io/') | ||
@GrabResolver(name = 'central', root='https://repo1.maven.org/maven2/') | ||
@Grapes([ | ||
@Grab('org.apache.groovy:groovy-json:4.0.13'), | ||
@Grab('com.github.Steppschuh:Java-Markdown-Generator:1.3.2') | ||
]) | ||
|
||
final dummyClassResults = [:] | ||
final noopResults = [:] | ||
|
||
final resultsPath = Path.of('jmh_results') | ||
Files.list(resultsPath).map { it.resolve('result.json') } | ||
.map { [new JsonSlurper().parse(it.toFile()), it.parent.fileName.toString().substring('jmh_'.length())] } | ||
.forEach { | ||
dummyClassResults[it[1]] = "${it[0][0].primaryMetric.score.round(2)} ± ${it[0][0].primaryMetric.scoreError.round(2)} ${it[0][0].primaryMetric.scoreUnit}" | ||
noopResults[it[1]] = "${it[0][1].primaryMetric.score.round(2)} ± ${it[0][1].primaryMetric.scoreError.round(2)} ${it[0][1].primaryMetric.scoreUnit}" | ||
} | ||
|
||
Table.Builder dummyClassTable = new Table.Builder() | ||
.withAlignments(Table.ALIGN_RIGHT, Table.ALIGN_RIGHT) | ||
.addRow('JDK name & Version', 'Benchmark results') | ||
dummyClassResults.sort { a, b -> a.value <=> b.value }.forEach { type, results -> dummyClassTable.addRow(type, results) } | ||
|
||
Table.Builder noopTable = new Table.Builder() | ||
.withAlignments(Table.ALIGN_RIGHT, Table.ALIGN_RIGHT) | ||
.addRow('JDK name & Version', 'Benchmark results') | ||
noopResults.sort { a, b -> a.value <=> b.value }.forEach { type, results -> noopTable.addRow(type, results) } | ||
|
||
new File('jmh_results.md').text = """ | ||
# `cpw.mods.modlauncher.benchmarks.TransformBenchmark.transformDummyClass` results | ||
${dummyClassTable.build()} | ||
# `cpw.mods.modlauncher.benchmarks.TransformBenchmark.transformNoop` results | ||
${noopTable.build()} | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: Test JVMs and publish Jmh results | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
pull_request: | ||
types: [opened, synchronize] | ||
|
||
jobs: | ||
testjdks: | ||
name: Test JDK ${{ matrix.jdk }} version ${{ matrix.jvm_version }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
max-parallel: 10 | ||
fail-fast: false | ||
matrix: | ||
jvm_version: [ 17, 18, 19, 20 ] | ||
jdk: [ Graal_VM, Adoptium, Azul, IBM, Oracle, Amazon, BellSoft, SAP ] | ||
exclude: | ||
- jdk: Graal_VM | ||
jvm_version: 18 # Graal doesn't have a dedicated J18 version | ||
include: | ||
- jdk: Microsoft | ||
jvm_version: 17 # MS OpenJDK only has 11 and 177 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@main | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
cache-disabled: true | ||
generate-job-summary: false | ||
- name: Make gradlew executable | ||
run: chmod +x ./gradlew | ||
- name: Run Jmh with Gradle Wrapper | ||
run: ./gradlew :jmh -PjmhVendor=${{ matrix.jdk }} -PjmhVersion=${{ matrix.jvm_version }} | ||
- uses: actions/upload-artifact@v3 | ||
name: Upload Results | ||
with: | ||
name: jmh_${{ matrix.jdk }}-${{ matrix.jvm_version }} | ||
path: build/reports/jmh/result.json | ||
|
||
upload_results: | ||
name: Upload Jmh results | ||
needs: [testjdks] | ||
runs-on: ubuntu-latest | ||
if: ${{ always() }} | ||
steps: | ||
- name: Setup Groovy | ||
uses: wtfjoke/setup-groovy@v1 | ||
with: | ||
groovy-version: '4.x' | ||
- name: Checkout repository | ||
uses: actions/checkout@main | ||
- name: Downloads results | ||
uses: actions/download-artifact@v3 | ||
id: download | ||
with: | ||
path: jmh_results | ||
- name: Collect results | ||
run: groovy .github/workflows/collect_jmh_results.groovy | ||
- name: Upload Final Results | ||
run: cat jmh_results.md >> $GITHUB_STEP_SUMMARY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters