Files
2025-09-13 19:25:16 +02:00

245 lines
8.5 KiB
YAML

name: benchmarks
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
jobs:
posix:
strategy:
fail-fast: false
matrix:
include:
- name: gcc-x64
compiler: g++-14
architecture: -m64 -march=native
sourcefile: comparison_table.cpp
compileroptions: -std=c++2b -O3 -DNDEBUG
outputfile: benchmark
reportdir: gcc-x64
os: [self-hosted, linux, x64]
install: g++-14-multilib
command: >
echo -e "\n#### \`N\` = 1M elements" &&
./benchmark 1000000 &&
echo -e "\n#### \`N\` = 10M elements" &&
./benchmark 10000000
- name: clang-x64
compiler: clang++-18
architecture: -m64 -march=native -mtune=native
sourcefile: comparison_table.cpp
compileroptions: -std=c++2b -O3 -DNDEBUG
outputfile: benchmark
reportdir: clang-x64
os: [self-hosted, linux, x64]
install: clang-18
command: >
echo -e "\n#### \`N\` = 1M elements" &&
./benchmark 1000000 &&
echo -e "\n#### \`N\` = 10M elements" &&
./benchmark 10000000
- name: clang-arm64
compiler: clang++
architecture: -m64 -march=native -mtune=native
sourcefile: comparison_table.cpp
compileroptions: -std=c++2b -O3 -DNDEBUG
outputfile: benchmark
reportdir: clang-arm64
os: [self-hosted, macOS, ARM64]
command: >
echo -e "\n#### \`N\` = 1M elements" &&
./benchmark 1000000 &&
echo -e "\n#### \`N\` = 10M elements" &&
./benchmark 10000000
xcode_version: 15.4
- name: gcc-x86
compiler: g++-14
architecture: -m32
sourcefile: comparison_table.cpp
compileroptions: -std=c++2b -O3 -DNDEBUG
outputfile: benchmark
reportdir: gcc-x86
os: [self-hosted, linux, x64]
install: g++-14-multilib
command: >
echo -e "\n#### \`N\` = 1M elements" &&
./benchmark 1000000 &&
echo -e "\n#### \`N\` = 10M elements" &&
./benchmark 10000000
- name: clang-x86
compiler: clang++-18
architecture: -m32
sourcefile: comparison_table.cpp
compileroptions: -std=c++2b -O3 -DNDEBUG
outputfile: benchmark
reportdir: clang-x86
os: [self-hosted, linux, x64]
install: clang-18 libstdc++-12-dev:i386
command: >
echo -e "\n#### \`N\` = 1M elements" &&
./benchmark 1000000 &&
echo -e "\n#### \`N\` = 10M elements" &&
./benchmark 10000000
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
- name: Install packages
if: matrix.install
run: |
# sudo -E apt-add-repository -y ppa:ubuntu-toolchain-r/test
if uname -p | grep -q 'x86_64'; then sudo dpkg --add-architecture i386 ; fi
sudo apt-get update
sudo apt-get install -y ${{matrix.install}}
- name: Install Boost
run: |
cd $GITHUB_WORKSPACE
git clone https://github.com/boostorg/boost.git boost-root
cd boost-root
git checkout develop
git submodule update --init
./bootstrap.sh
./b2 -d0 headers
- name: Install Boost.Bloom develop branch
run: |
cd $GITHUB_WORKSPACE
git clone -b develop https://github.com/joaquintides/bloom.git bloom-root
- name: Compile
run: |
cd $GITHUB_WORKSPACE
${{matrix.compiler}} --version
${{matrix.compiler}} $GITHUB_WORKSPACE/bloom-root/benchmark/${{matrix.sourcefile}} ${{matrix.architecture}} ${{matrix.compileroptions}} -o ${{matrix.outputfile}} -I$GITHUB_WORKSPACE/boost-root -I$GITHUB_WORKSPACE/bloom-root/include
- name: Set reportfile name
run: |
echo "REPORT_FILE=${{matrix.reportdir}}/${{matrix.sourcefile}}.txt" >> $GITHUB_ENV
- name: Run benchmarks
run: |
if [ -n "${{matrix.xcode_version}}" ]; then
DEVELOPER_DIR=/Applications/Xcode-${{matrix.xcode_version}}.app/Contents/Developer
fi
echo "running benchmarks and saving to "${REPORT_FILE}
(${{matrix.command}}) | tee ${REPORT_FILE}
- name: Push benchmark results to repo
run: |
git config --global user.name 'joaquintides'
git config --global user.email 'joaquintides@users.noreply.github.com'
git add ${REPORT_FILE}
git stash -- ${REPORT_FILE}
git pull
git stash pop
git add ${REPORT_FILE}
git commit -m "updated benchmark results"
git push
windows:
strategy:
fail-fast: false
matrix:
include:
- name: vs-x64
compiler: cl
architecture: x64
sourcefile: comparison_table.cpp
compileroptions: /std:c++20 /O2 /GL /D "NDEBUG" /EHsc /MD /Fe:benchmark.exe /arch:AVX2
outputfile: benchmark.exe
reportdir: vs-x64
os: [self-hosted, Windows, X64]
command: >
Write-Output "`n#### ``N`` = 1M elements";
./benchmark 1000000;
Write-Output "`n#### ``N`` = 10M elements";
./benchmark 10000000
- name: vs-x86
compiler: cl
architecture: x86
sourcefile: comparison_table.cpp
compileroptions: /std:c++20 /O2 /GL /D "NDEBUG" /EHsc /MD /Fe:benchmark.exe /arch:AVX2
outputfile: benchmark.exe
reportdir: vs-x86
os: [self-hosted, Windows, X64]
command: >
Write-Output "`n#### ``N`` = 1M elements";
./benchmark 1000000;
Write-Output "`n#### ``N`` = 10M elements";
./benchmark 10000000
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
- name: Install Boost
shell: cmd
run: |
cd %GITHUB_WORKSPACE%
git clone https://github.com/boostorg/boost.git boost-root
cd boost-root
git checkout develop
git submodule update --init
cmd /c bootstrap.bat
.\b2.exe -d0 headers
- name: Install Boost.Bloom develop branch
shell: cmd
run: |
cd %GITHUB_WORKSPACE%
git clone -b develop https://github.com/joaquintides/bloom.git bloom-root
- name: Compile
shell: cmd
run: |
cd %GITHUB_WORKSPACE%
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.architecture}}
set INCLUDE=%INCLUDE%;%GITHUB_WORKSPACE%\boost-root;%GITHUB_WORKSPACE%\bloom-root\include
echo %INCLUDE%
${{matrix.compiler}} %GITHUB_WORKSPACE%\bloom-root\benchmark\${{matrix.sourcefile}} ${{matrix.compileroptions}}
- name: Set reportfile name
shell: powershell
run: |
echo "REPORT_FILE=${{matrix.reportdir}}\${{matrix.sourcefile}}.txt" >> $env:GITHUB_ENV
- name: Run benchmark
shell: powershell
run: |
echo "running benchmarks and saving to $env:REPORT_FILE"
$(${{matrix.command}}) | Set-Content $env:REPORT_FILE -Passthru
- name: Push benchmark results to repo
shell: powershell
run: |
git config --global user.name 'joaquintides'
git config --global user.email 'joaquintides@users.noreply.github.com'
git add $env:REPORT_FILE
git stash -- $env:REPORT_FILE
git pull
git stash pop
git add $env:REPORT_FILE
git commit -m "updated benchmark results"
git push
final:
needs: [posix,windows]
runs-on: ubuntu-22.04
container:
image: python:2.7.18-buster
steps:
- uses: actions/checkout@v3
- name: Fast-forward repo
run: |
git pull
- name: Run data feeding script
run: |
./insert_data.sh
- name: Push modified README.md to repo
run: |
git config --global user.name 'joaquintides'
git config --global user.email 'joaquintides@users.noreply.github.com'
git commit -am "updated README.md"
git push