-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* run benchmarks with opcache enabled * output github friendly benchmarks * ci: run benchmarks with diff * ci: don't fail if baseline is not available * ci: fix github mardown template * simplify markdown table generation without hooking into phpbench * simplify benchmark in ci * fix ci * fix ci * remove phpbench from packages * fix ci * run main branch benchmarks with main branch dependencies * step summary instead of PR comment * ci: add retry threshold to benchmarks * ci: disable jit for opcache enabled benchmarks --------- Co-authored-by: jlabedo <jean@needelp.com> Co-authored-by: Dariusz Gafka <dgafka.mail@gmail.com>
- Loading branch information
1 parent
399d380
commit 35280d2
Showing
11 changed files
with
194 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
name: 'PR stats' | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
run: | ||
name: "Benchmark" | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
matrix: | ||
operating-system: [ ubuntu-latest ] | ||
php-versions: [ 8.2 ] | ||
stability: [prefer-stable] | ||
services: | ||
rabbitmq: | ||
image: rabbitmq:3.8-alpine | ||
env: | ||
RABBITMQ_DEFAULT_USER: guest | ||
RABBITMQ_DEFAULT_PASS: guest | ||
ports: | ||
- 5672:5672 | ||
mysql: | ||
image: mysql:8.0 | ||
env: | ||
MYSQL_ROOT_PASSWORD: "secret" | ||
MYSQL_USER: "ecotone" | ||
MYSQL_PASSWORD: "secret" | ||
MYSQL_DATABASE: "ecotone" | ||
DB_PORT: 3306 | ||
options: >- | ||
--health-cmd="mysqladmin ping" | ||
--health-interval=10s | ||
--health-timeout=5s | ||
--health-retries=3 | ||
ports: | ||
- 3306:3306 | ||
postgres: | ||
image: postgres | ||
env: | ||
POSTGRES_USER: ecotone | ||
POSTGRES_PASSWORD: secret | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 5432:5432 | ||
localstack: | ||
image: localstack/localstack:0.8.10 | ||
env: | ||
SERVICES: 'sqs,sns' | ||
ports: | ||
- '4576:4576' | ||
- '4575:4575' | ||
redis: | ||
image: redis:7-alpine | ||
ports: | ||
- '6379:6379' | ||
env: | ||
RABBIT_HOST: amqp://127.0.0.1:5672 | ||
SQS_DSN: sqs:?key=key&secret=secret®ion=us-east-1&endpoint=http://127.0.0.1:4576&version=latest | ||
REDIS_DSN: redis://127.0.0.1:6379 | ||
DATABASE_DSN: pgsql://ecotone:secret@127.0.0.1:5432/ecotone | ||
APP_DB_HOST: 127.0.0.1 | ||
APP_DB_PORT: 5432 | ||
APP_DB_DRIVER: pdo_pgsql | ||
steps: | ||
- name: PHP ${{ matrix.php-versions }} - ${{ matrix.stability }} | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
coverage: none | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
ref: main | ||
|
||
- name: Install dependencies | ||
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction | ||
|
||
- name: Benchmark main as baseline | ||
id: baseline | ||
continue-on-error: true | ||
run: | | ||
vendor/bin/phpbench --profile=opcache_enabled --retry-threshold=5 --tag=main.opcache_enabled | ||
vendor/bin/phpbench --profile=opcache_disabled --retry-threshold=5 --tag=main.opcache_disabled | ||
- uses: actions/checkout@v3 | ||
with: | ||
clean: false | ||
|
||
- name: Install dependencies | ||
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction | ||
|
||
- name: Benchmark PR with opcache enabled | ||
id: opcache_enabled | ||
env: | ||
PHPBENCH_REF_OPTION: "${{ steps.baseline.outcome == 'success' && '--ref=main.opcache_enabled' || '' }}" | ||
run: | | ||
vendor/bin/phpbench run --profile=opcache_enabled --retry-threshold=5 --report=github-report $PHPBENCH_REF_OPTION | bin/phpbench-to-md.sh > opcache_enabled.md | ||
cat opcache_enabled.md | ||
echo '## Opcache enabled' >> "$GITHUB_STEP_SUMMARY" | ||
cat opcache_enabled.md >> "$GITHUB_STEP_SUMMARY" | ||
- name: Benchmark PR with opcache disabled | ||
id: opcache_disabled | ||
env: | ||
PHPBENCH_REF_OPTION: "${{ steps.baseline.outcome == 'success' && '--ref=main.opcache_disabled' || '' }}" | ||
run: | | ||
vendor/bin/phpbench run --profile=opcache_disabled --retry-threshold=5 --report=github-report $PHPBENCH_REF_OPTION | bin/phpbench-to-md.sh > opcache_disabled.md | ||
cat opcache_disabled.md | ||
echo '## Opcache disabled' >> "$GITHUB_STEP_SUMMARY" | ||
cat opcache_disabled.md >> "$GITHUB_STEP_SUMMARY" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,5 @@ cache | |
packages/cache | ||
auth.json | ||
./config.json | ||
.env | ||
.env | ||
.phpbench/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 7 additions & 22 deletions
29
...fony/tests/Benchmark/EcotoneBenchmark.php → Monorepo/Benchmark/SymfonyBenchmark.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Transform the table output of phpbench | ||
# +------------------+-------------------------------------------+------+-----+----------+-----------+--------+ | ||
# | benchmark | subject | revs | its | mem_peak | mode | rstdev | | ||
# +------------------+-------------------------------------------+------+-----+----------+-----------+--------+ | ||
# | EcotoneBenchmark | bench_running_ecotone_lite_with_fail_fast | 1 | 1 | 3.186mb | 151.997ms | ±0.00% | | ||
# | EcotoneBenchmark | bench_running_ecotone_lite_with_cache | 1 | 1 | 4.915mb | 14.683ms | ±0.00% | | ||
# +------------------+-------------------------------------------+------+-----+----------+-----------+--------+ | ||
# (newline) | ||
# | ||
# into a valid markdown table: | ||
# | benchmark | subject | revs | its | mem_peak | mode | rstdev | | ||
# | ---------------- | ----------------------------------------- | ---- | --- | -------- | --------- | ------ | | ||
# | EcotoneBenchmark | bench_running_ecotone_lite_with_fail_fast | 1 | 1 | 3.186mb | 150.799ms | ±0.00% | | ||
# | EcotoneBenchmark | bench_running_ecotone_lite_with_cache | 1 | 1 | 4.915mb | 14.348ms | ±0.00% | | ||
|
||
# Read the input from stdin | ||
# Remove the last two lines | ||
# Remove the first line | ||
# Replace the table borders with pipes | ||
# Print the result | ||
head -n -2 | sed -n -e '1d' -e 's/-+-/ | /g' -e 's/+-/| /g' -e 's/-+/ |/g' -e p |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.