Hello,
This is not the first time I used your project, and I like it so much, because it help me to find bottlenecks on my own projects.
But this is the first time I used the xdebug:profile command :
==> https://phpbench.readthedocs.io/en/latest/extensions/xdebug.html
My context is the project https://github.com/overtrue/phplint on branch 9.6
Notified that we have a performance degradation on latest version 9.6.2 I've opened an issue to search and find origin of problem.
PHPBench 1.4.1 came to the rescue, but I didn't yet used the xdebug:profile command to generate the cachegrind.out.x files, I built it with XDebug itself.
So now, I've introduced the context, I'll aware you what I've found strange with PHAR distribution of PHPBench 1.4.1
Running as first attempt, I got such results

What I look strange here :
So, I've investigate to see what was wrong because I've xdebug and opcache extensions available/loaded on my current platform
PHP 8.2.28 (cli) (built: Mar 14 2025 00:50:23) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.28, Copyright (c) Zend Technologies
with Zend OPcache v8.2.28, Copyright (c), by Zend Technologies
with Xdebug v3.4.2, Copyright (c) 2002-2025, by Derick Rethans
Until I realized, that following your recommendation on documentation
https://phpbench.readthedocs.io/en/latest/quick-start.html

See my PHPBench config file at : https://github.com/overtrue/phplint/blob/9.6/phpbench.json
The xdebug and opcache extensions were disabled by runner.php_disable_ini directive.
My second attempt, with directive removed, was very better

Last but not least, if we don't specify a directory with *Bench.php file (like tests/Benchmark folder in my context), we got in trouble.
I used . (the project root folder of PHPLint clone source) as working directory rather than our tests/Benchmark dir
for example
devilbox@php-8.1.32 in /shared/backups/github/phplint-9.x $ /shared/backups/php/phpbench-1.4.phar xdebug:profile --bootstrap autoload.php . -vvv
Box Requirements Checker
========================
> Using PHP 8.1.32
> PHP is using the following php.ini file:
WARNING: No configuration file (php.ini) used by PHP!
> Checking Box requirements:
✔ The application requires a version matching "^8.1".
✔ The application requires the extension "zlib".
✔ The application requires the extension "dom".
✔ The application requires the extension "json".
✔ The application requires the extension "pcre".
✔ The application requires the extension "reflection".
✔ The application requires the extension "spl".
✔ The application requires the extension "tokenizer".
✔ The package "doctrine/annotations" requires the extension "tokenizer".
✔ The package "symfony/service-contracts" conflicts with the extension "psr".
[OK] Your system is ready to run the application.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchw4flYV'
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBench3jADyr'
PHPBench (1.4.1) running benchmarks... #standwithukraine
with configuration file: /shared/backups/github/phplint-9.x/phpbench.json
with PHP version 8.1.32, xdebug ❌, opcache ❌
[WARNING] File "LintProcessItem.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchTXtUiY'
[WARNING] File "LintProcess.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBench5ldxQg'
[WARNING] File "OutputInterface.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[WARNING] File "SarifOutput.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchsobDoe'
[WARNING] File "JunitOutput.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchDqOWnd'
[WARNING] File "CheckstyleOutput.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchgz2T4n'
[WARNING] File "ChainOutput.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchxYxGJP'
[WARNING] File "ConsoleOutput.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBench01qhLQ'
[WARNING] File "LinterOutput.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchqBz4bL'
[WARNING] File "FormatResolver.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchde5Yac'
[WARNING] File "ConsoleOutputInterface.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[WARNING] File "JsonOutput.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchPmN1Tk'
[WARNING] File "ProcessHelper.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchdPo9Aa'
[WARNING] File "DebugFormatterHelper.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBench0f5ysY'
[WARNING] File "Finder.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchDrNbOK'
[WARNING] File "Logger.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchcqMpId'
[WARNING] File "Resolver.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[WARNING] File "AbstractOptionsResolver.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchM0VHHl'
[WARNING] File "ConsoleOptionsResolver.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchbFPWLh'
[WARNING] File "Options.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[WARNING] File "FileOptionsResolver.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchWrf3WR'
[WARNING] File "OptionDefinition.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[WARNING] File "OptionsFactory.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchrc2LhE'
[WARNING] File "Client.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchabzn0X'
[WARNING] File "Linter.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchqdt5ck'
[WARNING] File "Application.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchoRg4v9'
[WARNING] File "BeforeLintFileInterface.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[WARNING] File "AfterLintFileInterface.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[WARNING] File "BeforeLintFileEvent.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchi0G0HU'
[WARNING] File "AfterCheckingEvent.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBench9AljQ5'
[WARNING] File "BeforeCheckingEvent.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchxSxtLv'
[WARNING] File "AfterLintFileEvent.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchNMUYZl'
[WARNING] File "EventDispatcher.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchDum5pi'
[WARNING] File "BeforeCheckingInterface.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[WARNING] File "AfterCheckingInterface.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[WARNING] File "ConfigureCommandTrait.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[WARNING] File "LintCommand.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchEIb7Eb'
[WARNING] File "Cache.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchMoEjpf'
[WARNING] File "OutputFormat.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchA6R9Pj'
[WARNING] File "ProgressBar.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchl0xVBi'
[WARNING] File "ProgressIndicator.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBench0cK4v1'
[WARNING] File "ProgressPrinter.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchsR3Uzg'
[WARNING] File "PsrCachedReader.php" has been identified as a benchmark file but it does not end with `Bench.php`. This behavior is incorrect and will be fixed in a future version. Set `runner.file_pattern` to `*Bench.php` in `phpbench.json` to avoid this.
[DEBUG] Spawning process: '/usr/local/bin/php' -n '/tmp/PhpBenchQPPHzv'
In Payload.php line 119:
[PhpBench\Remote\Exception\ScriptErrorException]
Fatal error: Uncaught Error: Interface "Doctrine\Common\Annotations\Reader" not found in /shared/backups/github/phplint-9.x/vendor-bin/phpb
ench/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/PsrCachedReader.php:23
Stack trace:
#0 /tmp/PhpBenchQPPHzv(19): require_once()
#1 {main}
thrown in /shared/backups/github/phplint-9.x/vendor-bin/phpbench/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/PsrCachedRea
der.php on line 23
Exception trace:
at phar:///shared/backups/php/phpbench-1.4.phar/lib/Remote/Payload.php:119
PhpBench\Remote\Payload->launch() at phar:///shared/backups/php/phpbench-1.4.phar/lib/Reflection/RemoteReflector.php:62
PhpBench\Reflection\RemoteReflector->reflect() at phar:///shared/backups/php/phpbench-1.4.phar/lib/Benchmark/Metadata/MetadataFactory.php:43
PhpBench\Benchmark\Metadata\MetadataFactory->getMetadataForFile() at phar:///shared/backups/php/phpbench-1.4.phar/lib/Benchmark/BenchmarkFinder.php:52
PhpBench\Benchmark\BenchmarkFinder->findBenchmarks() at phar:///shared/backups/php/phpbench-1.4.phar/lib/Benchmark/Runner.php:92
PhpBench\Benchmark\Runner->run() at phar:///shared/backups/php/phpbench-1.4.phar/lib/Console/Command/Handler/RunnerHandler.php:122
PhpBench\Console\Command\Handler\RunnerHandler->runFromInput() at phar:///shared/backups/php/phpbench-1.4.phar/extensions/xdebug/lib/Command/ProfileCommand.php:100
PhpBench\Extensions\XDebug\Command\ProfileCommand->execute() at phar:///shared/backups/php/phpbench-1.4.phar/vendor/symfony/console/Command/Command.php:326
Symfony\Component\Console\Command\Command->run() at phar:///shared/backups/php/phpbench-1.4.phar/vendor/symfony/console/Application.php:1078
Symfony\Component\Console\Application->doRunCommand() at phar:///shared/backups/php/phpbench-1.4.phar/vendor/symfony/console/Application.php:324
Symfony\Component\Console\Application->doRun() at phar:///shared/backups/php/phpbench-1.4.phar/vendor/symfony/console/Application.php:175
Symfony\Component\Console\Application->run() at phar:///shared/backups/php/phpbench-1.4.phar/lib/PhpBench.php:51
PhpBench\PhpBench::run() at phar:///shared/backups/php/phpbench-1.4.phar/bin/phpbench.php:25
require() at /shared/backups/php/phpbench-1.4.phar:15
xdebug:profile [--group GROUP] [--parameters PARAMETERS] [--assert ASSERT] [--format FORMAT] [--revs REVS] [-l|--progress PROGRESS] [--filter FILTER] [--variant VARIANT] [-b|--bootstrap BOOTSTRAP] [--executor EXECUTOR] [--stop-on-error] [--php-binary PHP-BINARY] [--php-config PHP-CONFIG] [--php-wrapper PHP-WRAPPER] [--php-disable-ini] [--outdir OUTDIR] [--gui] [--gui-bin GUI-BIN] [--] [<path>...]
Hello,
This is not the first time I used your project, and I like it so much, because it help me to find bottlenecks on my own projects.
But this is the first time I used the
xdebug:profilecommand :==> https://phpbench.readthedocs.io/en/latest/extensions/xdebug.html
My context is the project https://github.com/overtrue/phplint on branch
9.6Notified that we have a performance degradation on latest version 9.6.2 I've opened an issue to search and find origin of problem.
PHPBench 1.4.1 came to the rescue, but I didn't yet used the
xdebug:profilecommand to generate thecachegrind.out.xfiles, I built it with XDebug itself.So now, I've introduced the context, I'll aware you what I've found strange with PHAR distribution of PHPBench 1.4.1
Running as first attempt, I got such results
What I look strange here :
Allows to run benchmarking while
xdebugextension is disabled (I saw it after) and prints two things at opposite :4 profile(s) generated:Exception (message) raised from ProfileCommand
So, I've investigate to see what was wrong because I've
xdebugandopcacheextensions available/loaded on my current platformUntil I realized, that following your recommendation on documentation
https://phpbench.readthedocs.io/en/latest/quick-start.html
See my PHPBench config file at : https://github.com/overtrue/phplint/blob/9.6/phpbench.json
The
xdebugandopcacheextensions were disabled byrunner.php_disable_inidirective.My second attempt, with directive removed, was very better
Last but not least, if we don't specify a directory with
*Bench.phpfile (liketests/Benchmarkfolder in my context), we got in trouble.I used
.(the project root folder of PHPLint clone source) as working directory rather than ourtests/Benchmarkdirfor example