Skip to content

Commit

Permalink
Add CI benchmarking
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Jan 7, 2025
1 parent ddc0af4 commit 5a0b9da
Show file tree
Hide file tree
Showing 2 changed files with 129 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Benchmark

permissions:
contents: read

on:
push:
workflow_dispatch:
inputs:
ref:
description: "The commit or branch to benchmark"
required: true
type: string
merge_group:
branches:
- main

# Make sure only a single benchmark job runs at a time for the main branch to prevent conflicts when
# pushing the benchmark data.
concurrency:
group: "benchmarking-${{inputs.ref}}"
cancel-in-progress: false

jobs:
bench:
name: "Benchmark ${{ matrix.name }}"
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
matrix:
include:
- name: linux-x86
os: [benchmark, X64]
target: "x86_64-unknown-linux-gnu"
- name: macos-arm64
os: [benchmark, ARM64, macOS]
target: "aarch64-apple-darwin"
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
persist-credentials: false
ref: "${{inputs.ref}}"
fetch-depth: 2
- name: cargo build
run: |
. "$HOME/.cargo/env"
RUSTFLAGS="-Ctarget-cpu=native -Cllvm-args=-enable-dfa-jump-thread" cargo build --target ${{matrix.target}} -p test-libz-rs-sys --release --examples
cp target/${{matrix.target}}/release/examples/blogpost-compress .
cp target/${{matrix.target}}/release/examples/blogpost-uncompress .
- name: Benchmark
uses: trifectatechfoundation/benchmarker-action@main
with:
deploy-key: "${{ secrets.BENCH_DATA_DEPLOY_KEY }}"
bench-repo: "[email protected]:trifectatechfoundation/zlib-rs-bench.git"
metric-key: "${{ matrix.name }}"
benchmarks: "zlib_benchmarks.json"
72 changes: 72 additions & 0 deletions zlib_benchmarks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"blogpost-compress-rs": [
"./blogpost-compress 0 rs silesia-small.tar",
"./blogpost-compress 1 rs silesia-small.tar",
"./blogpost-compress 2 rs silesia-small.tar",
"./blogpost-compress 3 rs silesia-small.tar",
"./blogpost-compress 4 rs silesia-small.tar",
"./blogpost-compress 5 rs silesia-small.tar",
"./blogpost-compress 6 rs silesia-small.tar",
"./blogpost-compress 7 rs silesia-small.tar",
"./blogpost-compress 8 rs silesia-small.tar",
"./blogpost-compress 9 rs silesia-small.tar"
],
"blogpost-compress-ng": [
"./blogpost-compress 0 ng silesia-small.tar",
"./blogpost-compress 1 ng silesia-small.tar",
"./blogpost-compress 2 ng silesia-small.tar",
"./blogpost-compress 3 ng silesia-small.tar",
"./blogpost-compress 4 ng silesia-small.tar",
"./blogpost-compress 5 ng silesia-small.tar",
"./blogpost-compress 6 ng silesia-small.tar",
"./blogpost-compress 7 ng silesia-small.tar",
"./blogpost-compress 8 ng silesia-small.tar",
"./blogpost-compress 9 ng silesia-small.tar"
],
"blogpost-uncompress-rs": [
"./blogpost-uncompress rs-chunked 4 silesia-small.tar",
"./blogpost-uncompress rs-chunked 5 silesia-small.tar",
"./blogpost-uncompress rs-chunked 6 silesia-small.tar",
"./blogpost-uncompress rs-chunked 7 silesia-small.tar",
"./blogpost-uncompress rs-chunked 8 silesia-small.tar",
"./blogpost-uncompress rs-chunked 9 silesia-small.tar",
"./blogpost-uncompress rs-chunked 10 silesia-small.tar",
"./blogpost-uncompress rs-chunked 11 silesia-small.tar",
"./blogpost-uncompress rs-chunked 12 silesia-small.tar",
"./blogpost-uncompress rs-chunked 13 silesia-small.tar",
"./blogpost-uncompress rs-chunked 14 silesia-small.tar",
"./blogpost-uncompress rs-chunked 15 silesia-small.tar",
"./blogpost-uncompress rs-chunked 16 silesia-small.tar",
"./blogpost-uncompress rs-chunked 17 silesia-small.tar",
"./blogpost-uncompress rs-chunked 18 silesia-small.tar",
"./blogpost-uncompress rs-chunked 19 silesia-small.tar",
"./blogpost-uncompress rs-chunked 20 silesia-small.tar",
"./blogpost-uncompress rs-chunked 21 silesia-small.tar",
"./blogpost-uncompress rs-chunked 22 silesia-small.tar",
"./blogpost-uncompress rs-chunked 23 silesia-small.tar",
"./blogpost-uncompress rs-chunked 24 silesia-small.tar"
],
"blogpost-uncompress-ng": [
"./blogpost-uncompress ng-chunked 4 silesia-small.tar",
"./blogpost-uncompress ng-chunked 5 silesia-small.tar",
"./blogpost-uncompress ng-chunked 6 silesia-small.tar",
"./blogpost-uncompress ng-chunked 7 silesia-small.tar",
"./blogpost-uncompress ng-chunked 8 silesia-small.tar",
"./blogpost-uncompress ng-chunked 9 silesia-small.tar",
"./blogpost-uncompress ng-chunked 10 silesia-small.tar",
"./blogpost-uncompress ng-chunked 11 silesia-small.tar",
"./blogpost-uncompress ng-chunked 12 silesia-small.tar",
"./blogpost-uncompress ng-chunked 13 silesia-small.tar",
"./blogpost-uncompress ng-chunked 14 silesia-small.tar",
"./blogpost-uncompress ng-chunked 15 silesia-small.tar",
"./blogpost-uncompress ng-chunked 16 silesia-small.tar",
"./blogpost-uncompress ng-chunked 17 silesia-small.tar",
"./blogpost-uncompress ng-chunked 18 silesia-small.tar",
"./blogpost-uncompress ng-chunked 19 silesia-small.tar",
"./blogpost-uncompress ng-chunked 20 silesia-small.tar",
"./blogpost-uncompress ng-chunked 21 silesia-small.tar",
"./blogpost-uncompress ng-chunked 22 silesia-small.tar",
"./blogpost-uncompress ng-chunked 23 silesia-small.tar",
"./blogpost-uncompress ng-chunked 24 silesia-small.tar"
]
}

0 comments on commit 5a0b9da

Please sign in to comment.