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.
{
"$schema":"./vendor/phpbench/phpbench/phpbench.schema.json",
"runner.bootstrap": "vendor/autoload.php",
"runner.path": "path/to/benchmarks",
"report.outputs": {
"my_csv_output": {
"extends": "delimited",
"delimiter": ",",
}
},
"report.generators": {
"my_report": {
"extends": "aggregate"
}
}
}
You can include more configuratoin files with the $include
and
$include-glob
directives:
{
"$include": ["path/to/config.json"],
"$include-glob": ["path/to/*.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.php_env
- 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
- runner.file_pattern
- Report
- Expression
- Storage
- XDebug
- Console
Core¶
Extension class: PhpBench\Extension\CoreExtension
$schema¶
JSON schema location, e.g. ./vendor/phpbench/phpbench/phpbench.schema.json
Default: NULL
Types: ["string","null"]
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.php_env¶
Key-value set of environment variables to pass to the PHP process
Default: NULL
Types: ["array","null"]
runner.progress_summary_variant_format¶
Expression used to render the summary text default progress loggers
Default: label("Mo") ~ display_as_time(mode(variant.time.avg), coalesce(subject.time_unit,"time"), subject.time_precision, subject.time_mode) ~
" (" ~ 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: "[" ~
label("Mo") ~ display_as_time(mode(variant.time.avg), coalesce(subject.time_unit,"time"), subject.time_precision, subject.time_mode) ~
" vs. " ~
label("Mo") ~ display_as_time(mode(baseline.time.avg), coalesce(subject.time_unit,"time"), subject.time_precision, subject.time_mode) ~ "] " ~
percent_diff(mode(baseline.time.avg), mode(variant.time.avg), (rstdev(variant.time.avg) * 2)) ~
" (" ~ 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 pattern (regex) to use when finding benchmarks
Default: ^bench
Types: ["string"]
runner.file_pattern¶
Consider file names matching this pattern to be benchmarks. NOTE: In 2.0 this will be set to *Bench.php
Default: NULL
Types: ["string","null"]
Report¶
Extension class: PhpBench\Extension\ReportExtension
report.generators¶
Report generator configurations, see Report Generators
Default: []
Types: ["array"]
report.template_paths¶
List of paths to load templates from
Default: ["\/home\/daniel\/www\/phpbench\/phpbench\/lib\/Extension\/..\/..\/templates"]
Types: ["array"]
report.template_map¶
Namespace prefix to template path map for object rendering
Default: {"PhpBench\\Report\\Model":"html","PhpBench\\Expression\\Ast":"html\/node"}
Types: ["array"]
Expression¶
Extension class: PhpBench\Extension\ExpressionExtension
expression.memory_unit_prefix¶
By default use decimal
(1kb = 1000 bytes) or binary
(1KiB = 1024 bytes) when displaying memory
Default: decimal
Types: ["string"]
Allowed values: ["binary","decimal"]
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"]
storage.store_binary¶
If binary and serialized parameter values should be stored
Default: false
Types: ["boolean"]
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: NULL
Types: ["bool","null"]
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"]