Skip to content

Commit dbcacc5

Browse files
committed
README: add CI-measured cross-platform numbers (Windows 116s -> 67s)
1 parent 16b3e27 commit dbcacc5

3 files changed

Lines changed: 70 additions & 37 deletions

File tree

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Benchmark PHPUnit
2+
3+
# A/B wall-time benchmark: serial phpunit vs the Go parallel runner.
4+
# Scheduled only (not on pull requests); runs every 2 hours on ubuntu + windows.
5+
# Reminder: cron fires only from the default branch, so this starts running
6+
# once the file is on `main`.
7+
on:
8+
schedule:
9+
- cron: '0 */2 * * *'
10+
workflow_dispatch: null
11+
12+
env:
13+
COMPOSER_ROOT_VERSION: "dev-main"
14+
15+
jobs:
16+
benchmark:
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os: [ubuntu-latest, windows-latest]
21+
php-versions: ['8.4', '8.5']
22+
23+
runs-on: ${{ matrix.os }}
24+
timeout-minutes: 15
25+
26+
name: benchmark (${{ matrix.os }})
27+
steps:
28+
- uses: actions/checkout@v5
29+
30+
-
31+
uses: shivammathur/setup-php@v2
32+
with:
33+
php-version: ${{ matrix.php-versions }}
34+
coverage: none
35+
ini-values: zend.assertions=1
36+
37+
- uses: "ramsey/composer-install@v4"
38+
39+
- uses: actions/setup-go@v5
40+
with:
41+
go-version: 'stable'
42+
43+
- name: Serial phpunit
44+
shell: bash
45+
run: |
46+
printf '| platform | php | mode | wall time |\n| --- | --- | --- | --- |\n' >> "$GITHUB_STEP_SUMMARY"
47+
start=$SECONDS
48+
vendor/bin/phpunit
49+
echo "| ${{ matrix.os }} | ${{ matrix.php-versions }} | serial | $((SECONDS - start))s |" >> "$GITHUB_STEP_SUMMARY"
50+
51+
- name: Go parallel runner
52+
shell: bash
53+
run: |
54+
start=$SECONDS
55+
go run ./utils-tests-runner/main.go
56+
echo "| ${{ matrix.os }} | ${{ matrix.php-versions }} | go-runner | $((SECONDS - start))s |" >> "$GITHUB_STEP_SUMMARY"

‎.github/workflows/tests.yaml‎

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -39,38 +39,3 @@ jobs:
3939
- uses: "ramsey/composer-install@v4"
4040

4141
- run: vendor/bin/phpunit --colors
42-
43-
# proof of concept: same suite via the Go parallel runner, for an A/B time comparison
44-
fast_tests:
45-
strategy:
46-
fail-fast: false
47-
matrix:
48-
os: [ubuntu-latest, windows-latest]
49-
php-versions: ['8.4']
50-
51-
runs-on: ${{ matrix.os }}
52-
timeout-minutes: 4
53-
54-
name: PHP ${{ matrix.php-versions }} fast-phpunit (${{ matrix.os }})
55-
steps:
56-
- uses: actions/checkout@v5
57-
58-
-
59-
uses: shivammathur/setup-php@v2
60-
with:
61-
php-version: ${{ matrix.php-versions }}
62-
coverage: none
63-
ini-values: zend.assertions=1
64-
65-
- uses: "ramsey/composer-install@v4"
66-
67-
- uses: actions/setup-go@v5
68-
with:
69-
go-version: 'stable'
70-
71-
# `-o` writes the exact name, so add .exe on Windows ourselves
72-
- run: go build -o fast-phpunit${{ runner.os == 'Windows' && '.exe' || '' }} .
73-
working-directory: utils-tests-runner
74-
75-
# run from repo root so test-dir discovery and phpunit.xml resolve
76-
- run: ./utils-tests-runner/fast-phpunit${{ runner.os == 'Windows' && '.exe' || '' }}

‎utils-tests-runner/README.md‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,21 @@
33
Run the PHPUnit suite **~4x faster** by splitting test classes across parallel
44
workers that each boot PHP **once** and run many classes in a single process.
55

6-
## Speed — measured on this suite
6+
## Speed — CI, per platform (GitHub runners, 4 vCPU, full suite)
77

8-
Full suite: **685 test classes / 5833 fixtures**, 24-core host.
8+
Serial `vendor/bin/phpunit` vs this runner, measured on the CI run step:
9+
10+
| Platform | Serial | Go runner | Speedup |
11+
| --- | --- | --- | --- |
12+
| ubuntu-latest | 31s | **16s** | ~1.9x |
13+
| windows-latest | **116s** | **67s** | **~1.7x** |
14+
15+
Windows is the slow platform (~3.7x slower than Ubuntu serial); the runner cuts
16+
~49s off it. Both run the full suite and pass.
17+
18+
## Speed — local (24-core host, full suite)
19+
20+
Full suite: **685 test classes / 5833 fixtures**.
921

1022
| Mode | Wall time | vs serial |
1123
| --- | --- | --- |

0 commit comments

Comments
 (0)