Skip to content

Kotlin benchmarks

Kotlin benchmarks #2

Workflow file for this run

name: Kotlin benchmarks
on:
workflow_dispatch:
permissions:
contents: write
jobs:
get-inputs:
uses: ephemient/aoc2024/.github/workflows/get-inputs.yml@main
secrets:
SESSION: ${{ secrets.SESSION }}
jmh-visualizer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: jzillmann/jmh-visualizer
- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
- run: npm install
- run: npm run providedZip
env:
NODE_OPTIONS: --openssl-legacy-provider
- uses: actions/upload-artifact@v4
with:
name: jmh-visualizer
path: jmh-visualizer.zip
assemble:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- uses: gradle/actions/setup-gradle@v4
- run: ./gradlew assembleBenchmarks
working-directory: kt
build:
needs: [ assemble, get-inputs ]
runs-on: ubuntu-latest
strategy:
matrix:
target: [ jvm, js, linuxX64 ]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: inputs
path: inputs
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: true
- run: ./gradlew ${{ matrix.target }}BenchBenchmark
working-directory: kt
env:
AOC2024_DATADIR: ${{ github.workspace }}/inputs
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}-benchmarks
path: kt/aoc2024-exe/build/reports/benchmarks
docs:
needs: [ jmh-visualizer, build ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: gh-docs
- uses: actions/download-artifact@v4
with:
name: jmh-visualizer
- uses: actions/download-artifact@v4
with:
name: jvm-benchmarks
path: benchmarks
- uses: actions/download-artifact@v4
with:
name: js-benchmarks
path: benchmarks
- uses: actions/download-artifact@v4
with:
name: linuxX64-benchmarks
path: benchmarks
- run: rm -rf jmh-visualizer
- run: unzip -d jmh-visualizer jmh-visualizer.zip
- name: Create provided.js
run: |
shopt -s failglob
names=() jsonargs=()
for file in benchmarks/main/*/*.json; do
name=${file##*/}
name=${name%.*}
name=${name%Bench}
names+=("$name")
jsonargs+=(--slurpfile "$name" "$file")
done
cat >jmh-visualizer/provided.js <<EOF
// provided.js - generated by ${{ github.repository }}/${{ github.workflow }}, $(date +'%Y-%m-%d %H:%M:%S.%N')
var providedBenchmarks = $(jq --null-input --compact-output '$ARGS.positional|unique' --args "${names[@]}");
var providedBenchmarkStore = $(jq --null-input '$ARGS.named|map_values(.[0]|sort_by(.benchmark|[split("[.]|(?<!\\d)(?!\\D)|(?<!\\D)(?!\\d)")|map(try tonumber catch .),.]))' "${jsonargs[@]}");
EOF
- uses: EndBug/add-and-commit@v9
with:
add: jmh-visualizer
message: 'kotlinx.benchmark ${{ github.sha }}'