1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Benchmark
# bench/compare.sh on a GitHub-hosted runner, for architectures there is no
# other machine to measure on. Run by hand:
#
# gh workflow run bench.yml # x86_64
# gh workflow run bench.yml -f runner=ubuntu-24.04-arm
#
# The corpus is synthetic (bench/synth_logs.py): real logs never go to a public
# runner. Shared runner VMs are noisy, so read the ratios between rows, not the
# absolute times. The results land in the run summary and as an artifact.
on:
workflow_dispatch:
inputs:
runner:
description: "Runner label"
default: ubuntu-latest
reps:
description: "Repetitions per row (the best is reported)"
default: "3"
compress:
description: "Corpus format: gzip or zstd"
default: gzip
env:
CARGO_TERM_COLOR: always
jobs:
bench:
runs-on: ${{ inputs.runner }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install the tools being compared
run: sudo apt-get update -q && sudo apt-get install -y -q pigz ripgrep zstd
# Both backends: zlib-ng (the default) and the pure-Rust fallback.
- name: Build
run: |
cargo build --release
cargo build --release --no-default-features --target-dir target/miniz
mkdir -p bin
cp target/release/trg bin/trg-ng
cp target/miniz/release/trg bin/trg-miniz
- name: Build the corpus
run: |
mkdir -p synth
python3 bench/synth_logs.py synth
SRC=synth COMPRESS=${{ inputs.compress }} bench/build_corpus.sh /tmp/trgbench
- name: Compare
run: |
{
echo "## $(uname -m), $(nproc) cores, ${{ inputs.compress }} corpus"
echo
echo '```'
lscpu | grep -E 'Model name|^CPU\(s\)|Thread|L2|L3' || true
echo "SIMD: $(grep -owE 'avx2|avx512f|avx512vl|pclmulqdq|asimd|pmull|crc32' /proc/cpuinfo | sort -u | tr '\n' ' ')"
echo "$(rg --version | head -n1), $(gzip --version | head -n1), $(pigz --version 2>&1)"
echo
REPS=${{ inputs.reps }} TRG=bin/trg-miniz TRG_NAME=miniz_oxide TRG_ZLIBNG=bin/trg-ng \
bench/compare.sh /tmp/trgbench/corpus
echo '```'
} | tee results.md
cat results.md >> "$GITHUB_STEP_SUMMARY"
- uses: actions/upload-artifact@v4
with:
name: bench-${{ inputs.compress }}-${{ inputs.runner }}
path: results.md