Executors

Executors are the classes which perform the work and take the measurements.

The default executor is remote.

remote

Executes you benchmark in a separate process for each iteration.

This benchmark records:

  • Time in microseconds

  • Memory usage

Options:

php_config:

Type(s): array, Default: []

Key value array of ini settings, e.g. {"max_execution_time":100}

safe_parameters:

Type(s): bool, Default: true

INTERNAL: Use process process-safe parameters, this option exists for backwards-compatibility and will be removed in PHPBench 2.0

local

Executes the benchmark in the same process as PHPBench - only useful if you have included PHPBench as a dependency in your project and it shares the same autoloader.

This benchmark records:

  • Time in microseconds

Options:

  • none

debug

The debug executor returns a constant set of results, and is useful for debugging.

Options:

times:

Type(s): array, Default: 10

spread:

Type(s): array, Default: 0

memories:

Type(s): [null, array], Default: NULL

xdebug_profile

Execute benchmarks and enable XDebug profiling.

Note

You probably want to use the xdebug:profile command rather than this executor.

Options:

php_config:

Type(s): array, Default: []

Key value array of ini settings, e.g. {"max_execution_time":100}

safe_parameters:

Type(s): bool, Default: true

INTERNAL: Use process process-safe parameters, this option exists for backwards-compatibility and will be removed in PHPBench 2.0

callback:

Type(s): Closure, Default: {}

output_dir:

Type(s): string, Default: xdebug