Configuration¶
Unless overridden with the --config
option, PHPBench will try to load its
configuration from the current working directory. It will check for the
existence each of the files phpbench.json
and phpbench.json.dist
in
that order and use one if it exists.
{
"runner.bootstrap": "vendor/autoload.php",
"runner.path": "path/to/benchmarks",
"report.outputs": {
"my_csv_output": {
"extends": "delimited",
"delimiter": ",",
}
},
"report.generators": {
"my_report": {
"extends": "aggregate"
}
}
}
Note
Typically you should use phpbench.json.dist
in your projects. This
allows the end-user of your library to override your configuration by creating
phpbench.json
.
- Core
- Runner
- runner.annotations
- runner.annotation_import_use
- runner.attributes
- runner.bootstrap
- runner.env_enabled_providers
- runner.env_samplers
- runner.env_sampler_callables
- runner.executors
- runner.path
- runner.php_binary
- runner.php_config
- runner.php_disable_ini
- runner.php_wrapper
- runner.progress
- runner.progress_summary_variant_format
- runner.progress_summary_baseline_format
- runner.remote_script_path
- runner.remote_script_remove
- runner.assert
- runner.executor
- runner.format
- runner.iterations
- runner.output_mode
- runner.time_unit
- runner.retry_threshold
- runner.revs
- runner.timeout
- runner.warmup
- runner.subject_pattern
- Report
- Expression
- Storage
- XDebug
- Console
Core¶
Extension class: PhpBench\Extension\CoreExtension
core.debug¶
If enabled output debug messages (e.g. the commands being executed when running benchamrks). Same as -vvv
Default: false
Types: ["bool"]
core.working_dir¶
Working directory to use
Default: "\/home\/daniel\/www\/phpbench\/phpbench"
Types: ["string"]
core.config_path¶
Alternative path to a PHPBench configuration file (default is phpbench.json
Default: null
Types: ["string","null"]
core.profiles¶
Alternative configurations:
{
"core.profiles": {
"php8": {
"runner.php_bin": "/bin/php8"
}
}
}
The named configuration will be merged with the default configuration, and can be used via:
$ phpbench run --profile=php8
Default: []
Types: ["array"]
Runner¶
Extension class: PhpBench\Extension\RunnerExtension
runner.annotation_import_use¶
Require that annotations be imported before use
Default: false
Types: ["bool"]
runner.bootstrap¶
Path to bootstrap (e.g. vendor/autoload.php
)
Default: null
Types: ["string","null"]
runner.env_enabled_providers¶
Select which environment samplers to use
Default: ["sampler","git","opcache","php","uname","unix_sysload"]
Types: ["array"]
runner.env_samplers¶
Environment baselines (not to be confused with baseline comparisons when running benchmarks) are small benchmarks which run to sample the speed of the system (e.g. file I/O, computation etc). This setting enables or disables these baselines
Default: ["nothing","md5","file_rw"]
Types: ["array"]
runner.env_sampler_callables¶
Map of baseline callables (adds you to register a new environemntal baseline)
Default: []
Types: ["array"]
runner.php_binary¶
Specify a PHP binary to use when executing out-of-band benchmarks, e.g. /usr/bin/php6
, defaults to the version of PHP used to invoke PHPBench
Default: null
Types: ["string","null"]
runner.php_config¶
Map of PHP ini settings to use when executing out-of-band benchmarks
Default: []
Types: ["array"]
runner.php_disable_ini¶
Disable reading the default PHP configuration
Default: false
Types: ["bool"]
runner.php_wrapper¶
Wrap the PHP binary with this command (e.g. blackfire run
)
Default: null
Types: ["string","null"]
runner.progress_summary_variant_format¶
Expression used to render the summary text default progress loggers
Default: "\"Mo\" ~ display_as_time(mode(variant.time.avg), coalesce(subject.time_unit,\"time\"), subject.time_precision, subject.time_mode) ~ \n\" (\" ~ rstdev(variant.time.avg) ~ \")\""
Types: ["string"]
runner.progress_summary_baseline_format¶
When the a comparison benchmark is referenced, alternative expression used to render the summary text default progress loggers
Default: "\"[\" ~ \n\"Mo\" ~ display_as_time(mode(variant.time.avg), coalesce(subject.time_unit,\"time\"), subject.time_precision, subject.time_mode) ~\n\" vs \" ~ \n\"Mo\" ~ display_as_time(mode(baseline.time.avg), coalesce(subject.time_unit,\"time\"), subject.time_precision, subject.time_mode) ~ \"] \" ~ \npercent_diff(mode(baseline.time.avg), mode(variant.time.avg), (rstdev(variant.time.avg) * 2)) ~\n\" (\" ~ rstdev(variant.time.avg) ~ \")\""
Types: ["string"]
runner.remote_script_path¶
PHPBench generates a PHP file for out-of-band benchmarks which is executed, this setting specifies the path to this file. When NULL a file in the systems temporary directory will be used
Default: null
Types: ["string","null"]
runner.remote_script_remove¶
If the generated file should be removed after it has been executed (useful for debugging)
Default: true
Types: ["bool"]
runner.subject_pattern¶
Subject prefix to use when finding benchmarks
Default: "^bench"
Types: ["string"]
Report¶
Extension class: PhpBench\Extension\ReportExtension
report.generators¶
Report generator configurations, see Report Generators
Default: []
Types: ["array"]
Expression¶
Extension class: PhpBench\Extension\ExpressionExtension
Storage¶
Extension class: PhpBench\Extension\StorageExtension
storage.xml_storage_path¶
Path to store benchmark runs when they are stored with --store
or --tag=foo
Default: ".phpbench\/storage"
Types: ["string"]
XDebug¶
Extension class: PhpBench\Extensions\XDebug\XDebugExtension
xdebug.command_handler_output_dir¶
Output directory for generated XDebug profiles
Default: ".phpbench\/xdebug-profile"
Types: ["string"]
Console¶
Extension class: PhpBench\Extension\ConsoleExtension
console.ansi¶
Enable or disable ANSI control characters (e.g. console colors)
Default: true
Types: ["bool"]
console.output_stream¶
Change the normal output stream - the output stream used for reports
Default: "php:\/\/stdout"
Types: ["string"]
console.error_stream¶
Change the error output stream - the output stream used for diagnostics (e.g. progress loggers use this stream)
Default: "php:\/\/stderr"
Types: ["string"]