phpbench

Hrtime and Loops

, tagged: php phpbench
PHPBench currently samples the time taken (in microseconds) to run code around a loop. This post aims to provide some insight into: If there is a benefit to using a loop (@Revs) when taking a time sample. The value of using hrtime instead of microtime. Background ¶ PHPBench samples the time taken for your code to run. The default executor does this by iterating over your code a number of times (@Revs) and dividing the total time in microseconds (i. Read more...

PHPBench 1.2.0

, tagged: phpbench php
PHPBench 1.2.0 has been released, the highlights are: In reports you can now dynamically create and group columns in tables Memory can be displayed in binary memory units Support for filtering by variant name Support for filtering reports Report Improvements ¶ PHPBench 1.1.0 improved report generation, allowing you to use components such as tables and bar charts. This release improves table generation, adding support for grouping and expanding columns dynamically: Read more...

PHPBench 1.1.0

, tagged: phpbench php
PHPBench 1.1.0 as been tagged! PHPBench 1.0 removed many features, most were deemed useless, the HTML report was an exception and it has been re-introduced in 1.1 along with other improvements, some of the more notable ones being: “Safe” parameters: You can now use any serializable class as a parameter. This change included some internal refactorings and I have, to the best of my knowledge, preserved the B/C promise. $include and $include-glob configuration directives to include other configuratoin files. Read more...

Object Rendering or MVC the right way

, tagged: phpbench php
The templates we use in our favourite MVC frameworks are awful. You pass an unstructured bunch of data to a template which hopes the you passed everything it needed. They do not define what their inputs are, they are not type safe. For some years I’ve been using a different way of rendering views - it started when I was trying to create a new CMS framework, but since then it has come in useful time and time again. Read more...

PHPBench 1.0.0

, tagged: phpbench php
PHPBench 1.0.0 as been tagged! I started this project in 2015, I’d like to say I’ve been working on it for six years, but really I worked hard on it for about 6 months to a year and then largely ignored it when I started another project phpactor - which began with me wondering how easy it would be to add PHP auto completion in VIM and ended up with me writing a language server and “maintaining” over 50 packages. Read more...

PHPBench 1.0.0-alpha5

, tagged: phpbench php
PHPBench Alpha 5 as been tagged. I tagged PHPBench Alpha 1 in about 5 months ago since that time numerous improvements and features have been introduced, I will talk about three of them. Local Executor ¶ One problem I had when developing benchmarks is that it’s difficult to debug when the benchmark launches in a separate process, for this reason there is now the local executor: $ phpbench run --executor=local Will run the benchmark in the same process as PHPBench, allowing you to do whatever you need to do (var_dump($foo);die()) to debug your benchmark. Read more...

PHPBench Expression Language

, tagged: phpbench
In September 2020 I was on holiday and I made a decided effort to start working on PHPBench again, and I wrote a blog post about it. Iterations 1 and 2 (September 2020) ¶ One of the main features was a new assertion engine - and I wrote a simple parser. The first implementation used Parsica. It looked something like: /** * @Assert("variant.mode < baseline.mode +/- 5%") */ public function benchFoobar(): void { // . Read more...

PHPBench 1.0.0-alpha1

, tagged: phpbench php
PHPBench is over 5 years old. I started working on it because I wanted to write a new implementation of the PHPCR spec, and I wanted to ensure that it was faster than the existing Jackalope implementation, I needed a framework to write a large number of performance tests. The existing Athletic framework didn’t quite meet my needs so I decided to write my own. I didn’t write the next PHPCR implementation (luckily, it would have been terrible) but I did spend the next several months working on PHPBench, a large part of it was written while I was cycling from Vorarlberg (Austria) to Ankara going back through Greece and up to Slovenia. Read more...
1 of 1