Skip to content

benchmarks

benchmarks #270

Workflow file for this run

name: benchmarks
on:
# allow to trigger manually (on default branch)
workflow_dispatch:
# run once a week
schedule:
- cron: '0 0 * * 0'
defaults:
run:
shell: bash
jobs:
build-and-run:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# Linux
- name: linux-gcc
os: ubuntu-latest
# macOS
- name: macos-clang
os: macos-latest
# no Windows, as Kleenex generates non-portable C code
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '11'
- name: Setup Common Prerequisites
run: |
case ${{ runner.os }} in
Linux*)
echo "CC=gcc" >> $GITHUB_ENV
echo "CXX=g++" >> $GITHUB_ENV
sudo apt update
sudo apt install libre2-dev libbenchmark-dev
;;
macOS*)
sudo xcode-select -switch /Applications/Xcode.app
echo "CC=$(xcrun -f clang)" >> $GITHUB_ENV
echo "CXX=$(xcrun -f clang++)" >> $GITHUB_ENV
echo "SDKROOT=$(xcodebuild -version -sdk macosx Path)" >> $GITHUB_ENV
echo "$(xcodebuild -version -sdk macosx Path)" >> $GITHUB_PATH
brew install re2 google-benchmark
;;
esac
pip install psutil
- name: Configure
run: |
cmake -S . -B .build \
-G "Unix Makefiles" \
-DRE2C_BUILD_LIBS=ON \
-DRE2C_BUILD_RE2D=OFF \
-DRE2C_BUILD_RE2GO=OFF \
-DRE2C_BUILD_RE2HS=OFF \
-DRE2C_BUILD_RE2JAVA=OFF \
-DRE2C_BUILD_RE2JS=OFF \
-DRE2C_BUILD_RE2OCAML=OFF \
-DRE2C_BUILD_RE2PY=OFF \
-DRE2C_BUILD_RE2RUST=OFF \
-DRE2C_BUILD_RE2V=OFF \
-DRE2C_BUILD_RE2ZIG=OFF \
-DRE2C_BUILD_BENCHMARKS=ON \
-DCMAKE_CXX_FLAGS="-O3"
- name: Build
run: cmake --build .build
- name: Run submatch DFA AOT benchmark
working-directory: .build/benchmarks/c
run: |
./run.py --quickverify \
&& ./run.py --repetitions 5 --output results.json \
&& cat results.json
- name: Run submatch DFA JIT benchmark
working-directory: .build/benchmarks/c/libre2c/jit
run: ./bench_submatch_jit
- name: Run submatch Java benchmark (ReTdfa)
working-directory: .build/benchmarks/c/libre2c/java
run: ./run.py
- name: Run submatch NFA benchmark
working-directory: .build/benchmarks/c/libre2c/nfa
run: ./bench_submatch_nfa