Skip to content

Commit e85d1ee

Browse files
committed
benchmark setup
1 parent 445c4da commit e85d1ee

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

.github/workflows/bench.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Benchmark
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
inputs:
12+
ref:
13+
description: "The commit or branch to benchmark"
14+
required: true
15+
type: string
16+
merge_group:
17+
branches:
18+
- main
19+
20+
# Make sure only a single benchmark job runs at a time for the main branch to prevent conflicts when
21+
# pushing the benchmark data.
22+
concurrency:
23+
group: "benchmarking-${{inputs.ref}}"
24+
cancel-in-progress: false
25+
26+
jobs:
27+
bench:
28+
name: "Benchmark ${{ matrix.name }}"
29+
runs-on: ${{ matrix.os }}
30+
timeout-minutes: 30
31+
strategy:
32+
matrix:
33+
include:
34+
- name: linux-x86
35+
os: [benchmark, X64]
36+
target: "x86_64-unknown-linux-gnu"
37+
- name: macos-arm64
38+
os: [benchmark, ARM64, macOS]
39+
target: "aarch64-apple-darwin"
40+
steps:
41+
- name: Checkout sources
42+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
43+
with:
44+
persist-credentials: false
45+
ref: "${{inputs.ref}}"
46+
fetch-depth: 0 # ensure the base commit to compare against is available
47+
- name: cargo build
48+
env:
49+
RUSTFLAGS: "-Cllvm-args=-enable-dfa-jump-thread"
50+
run: |
51+
. "$HOME/.cargo/env"
52+
cargo build --target ${{matrix.target}} -p test-libzstd-rs-sys --release --examples
53+
cp target/${{matrix.target}}/release/examples/decompress .
54+
- name: Benchmark
55+
uses: trifectatechfoundation/benchmarker-action@main
56+
with:
57+
deploy-key: "${{ secrets.BENCH_DATA_DEPLOY_KEY }}"
58+
bench-repo: "[email protected]:trifectatechfoundation/libzstd-rs-sys-bench.git"
59+
metric-key: "${{ matrix.name }}"
60+
benchmarks: "benchmarks.json"

benchmarks.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"commands": {
3+
"decompress-rs": [
4+
"./decompress rs silesia-small.tar"
5+
],
6+
"decompress-c": [
7+
"./decompress c silesia-small.tar"
8+
]
9+
},
10+
"render-versus-self": {
11+
"decompression (c vs rs)": {
12+
"silesia-small.tar": { "measure": "cycles", "before": { "command": "decompress-c", "index": 0 }, "after": { "command": "decompress-rs", "index": 0 } }
13+
}
14+
},
15+
"render-versus-other": {
16+
"decompression (rs, other versus self)": {
17+
"measure": "cycles",
18+
"command": "decompress",
19+
"rows": {
20+
"silesia-small.tar": 0
21+
}
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)