Skip to content

Makefile: added phpbench target#5250

Merged
staabm merged 8 commits intophpstan:2.1.xfrom
staabm:bench
Mar 19, 2026
Merged

Makefile: added phpbench target#5250
staabm merged 8 commits intophpstan:2.1.xfrom
staabm:bench

Conversation

@staabm
Copy link
Copy Markdown
Contributor

@staabm staabm commented Mar 19, 2026

allow running the benchmark locally.

this seems useful, as I recently got 'red' benchmark github action jobs, and want to verify/reproduce locally


adds 2 new makefile targets

make phpbench-baseline (re)-generates the baseline
make phpbench verifies a recent enough baseline exists and runs the tests, compares them against the baseline

to achieve this we add the phpbench composer dependency at the start and later on remove it again.

allow running the benchmark locally
Comment thread Makefile Outdated

.PHONY: phpbench
phpbench:
composer require --dev phpbench/phpbench:^1.2.15
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not always adding it as dev dependency ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess ondrej did it that way because PHP version support for 7.2 in CI would not work.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

phpbench is already a dependency in tests/composer.json. No need to add it here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point. will be simplified in #5251

@staabm staabm requested a review from VincentLanglet March 19, 2026 10:54
@staabm staabm merged commit 2eb68ac into phpstan:2.1.x Mar 19, 2026
378 checks passed
@staabm staabm deleted the bench branch March 19, 2026 11:25
Comment thread Makefile

.PHONY: phpbench-baseline
phpbench-baseline:
composer require --dev phpbench/phpbench:^1.2.15 -q
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be here. Use the phpbench from tests/.

phpstan-bot pushed a commit to phpstan-bot/phpstan-src that referenced this pull request Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants