PHPBench is a benchmark runner for PHP analagous to PHPUnit but for performance rather than correctness.

Performance can be monitored and measured in a number of ways: profiling (via. Xdebug or Blackfire), manually instrumenting your code (e.g. Symfony Stopwatch) or with APM tools such as NewRelic or Tideways.

PHPBench compliments these tools (and in some cases can integrate with them) allowing you to profile the wall time and memory usage of specific scenarios and code units independently of the application context.

Features include but are not limited to:

  • Revolutions: Repeat your code many times to determine average execution time.
  • Iterations: Sample your revolutions many times and review aggregated statistical data.
  • Process Isolation: Each iteration is executed in a separate process.
  • Reporting: Customizable reports and various output formats (e.g. console, CSV, Markdown, HTML).
  • Report Storage and comparison: Store benchmarks locally to be used as a baseline reference, or to reference them later.
  • Memory Usage: Keep an eye on the amount of memory used by benchmarking subjects.
  • Assertions: Assert that code is performing within acceptable limits, or that it has not regressed from a previously recorded baseline.