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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
name: Benchmark
on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- 'src/**'
- '.github/workflows/benchmark.yml'
pull_request:
branches: [ main ]
permissions:
contents: read
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
jobs:
lzbench-benchmark:
name: Run Benchmark
if: github.event.pull_request.draft == false
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest-xlarge]
env:
LZBENCH_DIR: lzbench
SILESIA_DIR: silesia
steps:
- name: Checkout Repository
uses: actions/checkout@v6
- name: Clone LZbench
run: |
git clone -b zxc-0.9.x https://github.com/hellobertrand/lzbench "${LZBENCH_DIR}"
- name: Copy Lib ZXC
run: |
mkdir -p ${LZBENCH_DIR}/lz/zxc/include/
mkdir -p ${LZBENCH_DIR}/lz/zxc/src/lib/
cp -r include ${LZBENCH_DIR}/lz/zxc/
cp -r src/lib ${LZBENCH_DIR}/lz/zxc/src/
- name: Build Lzbench
working-directory: ${{ env.LZBENCH_DIR }}
run: |
make -j MOREFLAGS="-march=native"
- name: Cache Silesia Corpus
id: cache-silesia
uses: actions/cache@v5
with:
path: ${{ env.SILESIA_DIR }}
key: silesia-corpus-${{ runner.os }}-v1
- name: Download Silesia Corpus (${{ runner.os }})
if: steps.cache-silesia.outputs.cache-hit != 'true'
run: |
wget --no-check-certificate -q https://sun.aei.polsl.pl/~sdeor/corpus/silesia.zip -O silesia.zip
mkdir -p "${SILESIA_DIR}"
unzip -q silesia.zip -d "${SILESIA_DIR}"
- name: Run Lzbench on Silesia Corpus
working-directory: ${{ env.LZBENCH_DIR }}
run: |
./lzbench \
-e"memcpy/zxc/lz4/lz4fast,17/lz4hc,12/zstd,1/zstd_fast,-1/brotli,0/snappy" \
-j -t8,8 -o1 -r "../${SILESIA_DIR}"/ \
> ../benchmark.md
echo "Benchmark finished. First lines:"
head -n 40 ../benchmark.md
- name: Add Benchmark to Job Summary
if: always()
run: |
echo "### Résultats Benchmark (${{ matrix.os }})" >> $GITHUB_STEP_SUMMARY
cat benchmark.md >> $GITHUB_STEP_SUMMARY
- name: Upload Benchmark Result as Artifact
uses: actions/upload-artifact@v7
with:
name: benchmark-${{ matrix.os }}-${{ github.sha }}
path: benchmark.md
if-no-files-found: error
retention-days: 10
|