Skip to content

Benchmark

Benchmark #228

Workflow file for this run

name: Benchmark
on:
schedule:
- cron: '0 7 * * 2'
push:
paths:
- '**/**Benchmark.kt'
- '**/benchmark-summary.main.kts'
- '**/benchmark.yml'
env:
TRIGGER_COUNTER: 15
JMH_THREADS: 2
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
GRADLE_OPTS: "-Dorg.gradle.daemon=false \
-Dorg.gradle.configuration-cache=false \
-Dorg.gradle.vfs.watch=false \
-Dorg.gradle.unsafe.watch-fs=false \
"
jobs:
os-checks:
strategy:
fail-fast: false
matrix:
# TODO: Benchmark on different JDK distributions?
# https://www.ojalgo.org/2019/02/quick-test-to-compare-hotspot-and-openj9/
java: [ '17' ]
os: [ 'macos', 'windows', 'ubuntu' ]
benchmark: [ 'IncrementIntent.*' ]
name: '${{ matrix.os }} JDK${{ matrix.java }} "${{ matrix.benchmark }}" benchmark'
runs-on: '${{ matrix.os }}-latest'
steps:
- name: Harden Runner
if: matrix.os == 'ubuntu'
uses: step-security/harden-runner@0c6ab70129fa3660acd9cd2b51e8685d619cd613
with:
disable-sudo: true
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
- name: 'Set up JDK ${{ matrix.java }}'
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '${{ matrix.java }}'
# macos runner provides more CPU cores.
- if: matrix.os == 'macos'
run: echo "JMH_THREADS=3" >> $GITHUB_ENV
- name: 'Benchmark "${{ matrix.benchmark }}" on ${{ matrix.os }} JDK${{ matrix.java }}'
uses: gradle/gradle-build-action@v2
env:
CI: true
jmh: '${{ matrix.benchmark }}'
jmh_wi: 1
jmh_i: 6
jmh_f: 2
jmh_t: '${{ env.JMH_THREADS }}'
with:
gradle-home-cache-cleanup: true
cache-disabled: ${{ matrix.java == '11' }}
cache-read-only: ${{ github.ref != 'refs/heads/main' || matrix.java != '17' }}
arguments: jmh --stacktrace --no-configuration-cache --scan
- name: Summary
run: ./.github/workflows/benchmark-summary.main.kts >> $GITHUB_STEP_SUMMARY
shell: bash