Skip to content

b-viguier/phpbench

 
 

Repository files navigation

PhpBench

Build Status StyleCI

PhpBench is a benchmarking framework for PHP.

Features:

  • Generate reports.
  • Benchmarks are executed in a separate process, effectively with no overhead.
  • Memory usage statistics in addition to time.
  • Support for parameterized benchmarking cases.
  • Per-project configuration.
  • Dump benchmark results as XML and generate reports later
  • Run one or more (setup) parameterized methods before the benchmark
  • Nice command line interface
  • Implement your own Report Generators
  • Implement your own Progress Loggers
  • Utilizes Tabular for creating custom reports.
  • More
$ phpbench run examples/CostOfReflectionBench.php --report=aggregate
PhpBench 0.5. Running benchmarks.

......
Done (6 subjects, 24 iterations) in 0.94s

+-----------------------+----------------------------+-------+--------+-------+-------+----------+--------+-----------+-----------+
| benchmark             | subject                    | group | params | revs  | iters | time     | memory | deviation | stability |
+-----------------------+----------------------------+-------+--------+-------+-------+----------+--------+-----------+-----------+
| CostOfReflectionBench | benchMethodSet             |       | []     | 40000 | 4     | 1.7951μs | 672b   | +80.57%   | 93.45%    |
| CostOfReflectionBench | benchPublicProperty        |       | []     | 40000 | 4     | 0.9941μs | 640b   | 0.00%     | 98.03%    |
| CostOfReflectionBench | benchPublicReflection      |       | []     | 40000 | 4     | 1.8264μs | 656b   | +83.72%   | 96.51%    |
| CostOfReflectionBench | benchPrivateReflection     |       | []     | 40000 | 4     | 1.8983μs | 656b   | +90.95%   | 95.63%    |
| CostOfReflectionBench | benchNewClass              |       | []     | 40000 | 4     | 1.1369μs | 576b   | +14.36%   | 97.88%    |
| CostOfReflectionBench | benchReflectionNewInstance |       | []     | 40000 | 4     | 1.5314μs | 592b   | +54.04%   | 96.96%    |
+-----------------------+----------------------------+-------+--------+-------+-------+----------+--------+-----------+-----------+

Documentation and Installation Instructions

See the official documentation

See also

This library was influenced by the athletic benchmarking framework.

About

PHP Benchmarking framework

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%