From 4d14d35fbf956fa0f2ea594a14baad7d5c028aab Mon Sep 17 00:00:00 2001 From: SmetDenis Date: Sat, 30 Mar 2024 00:30:03 +0400 Subject: [PATCH] Refactor benchmark setup and enhance CSV generation logging This refactor splits the benchmark setup into two separate jobs for better handling of individual configurations: one for Docker-based benchmarks and another for PHP-based benchmarks. The jobs now support testing with varying numbers of columns. In addition, the CSV generation process now includes better-riched logs for easier debugging. --- .github/workflows/benchmark.yml | 40 ++++++++++++++++++++++++++++++--- Makefile | 5 ++--- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 6135a3db..194bd8b7 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -21,9 +21,12 @@ on: - 'master' jobs: - stress-test: - name: Benchmark + docker-benchmark: + name: via Docker runs-on: ubuntu-latest + strategy: + matrix: + columns: [ 1, 5, 10, 20 ] steps: - name: Checkout code uses: actions/checkout@v4 @@ -46,5 +49,36 @@ jobs: push: false tags: jbzoo/csv-blueprint:local - - name: 🔥 Benchmark with Docker 🔥 + - name: 🔥 Benchmark 🔥 run: make bench-docker --no-print-directory + + + php-benchmark: + name: via PHP + runs-on: ubuntu-latest + strategy: + matrix: + columns: [ 1, 5, 10, 20 ] + env: + BENCH_COLS: ${{ matrix.php-version }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.3 + coverage: none + ini-values: opcache.enable_cli=1, opcache.jit=1255 + + - name: Build project + run: make build --no-print-directory + + - name: Create random huge CSV files + run: make bench-create-csv --no-print-directory + + - name: 🔥 Benchmark 🔥 + run: make bench-php --no-print-directory diff --git a/Makefile b/Makefile index 34d7745b..5fd5eb75 100644 --- a/Makefile +++ b/Makefile @@ -95,13 +95,12 @@ BENCH_SCHEMAS := --schema='./tests/Benchmarks/benchmark-*.yml' BENCH_FLAGS := --debug --profile --report=text -vvv -bench-all: ##@Benchmarks Run all benchmarks +bench: ##@Benchmarks Run all benchmarks @make bench-create-csv - @make docker-build @make bench-docker bench-create-csv: ##@Benchmarks Create CSV file - $(call title,"Benchmark - Create CSV file") + $(call title,"Benchmark - Create CSV file. Cols=${BENCH_COLS} Rows=${BENCH_ROWS_SRC}_000") @mkdir -pv ./build/bench/ @rm -fv ./build/bench/*.csv @time bash ./tests/Benchmarks/create-csv.sh