-
Notifications
You must be signed in to change notification settings - Fork 10
PHPBench integration #61
Description
I would like to propose introducing PHPBench benchmarks into Hoa.
PHPBench is a benchmarking framework (micro and macro), it is structurally similar to PHPUnit, and can be used in any situation where you have written a microtime script to test something. It is somewhat similar to Java's JMH and was inspired by Athletic. It is still under development.
Some of its advantages:
- Benchmarks are located in the source repository (à la unit test files).
- It can generate themeable reports (to the console, in markdown, or in HTML)
- It can store results and allow you to compare different runs (eventually allowing you to store in a GIT branch).
- Iterations are executed in isolated processes.
I propose it here because I have seen similar micro-benchmarks showcased by @Hywan on IRC and, honestly, I want to know if PHPBench is useful and fit-for-purpose.
Benchmarks could be located in the following path:
LibraryName/Test/Benchmark/SomeBench.php
And PHPBench itself could either be installed as a require-dev dependency, or globally on the developers machine (there will be a PHAR at some point). The benchmarks themselves have no runtime dependency on PHPBench.
@Hywan expressed a wish for there to be assertions for memory and time with the implication that it could be used in the CI process. This is currently not a feature of PHPBench due to time being affected by the platform the benchmarks are running on, but CI assertions (in whatever form) are clearly something to work towards.
So, there it is. Just an idea, if you are interested maybe @Hywan could show me the code he used to generate his benchmarks and I could make a PR..