name: Benchmark
on:
workflow_dispatch:
inputs:
runner:
description: "Runner label"
default: ubuntu-latest
reps:
description: "Repetitions per row (the best is reported)"
default: "3"
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
- 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 bench/build_corpus.sh /tmp/trgbench
- name: Compare
run: |
{
echo "## $(uname -m), $(nproc) cores"
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.runner }}
path: results.md