An open API service indexing awesome lists of open source software.

https://github.com/jacobbednarz/php-bench

Benchmarking PHP, the easy way
https://github.com/jacobbednarz/php-bench

Last synced: about 2 months ago
JSON representation

Benchmarking PHP, the easy way

Awesome Lists containing this project

README

        

# PHP Benchmark - The easy way

This is designed to make benchmarking PHP easy.

### Installation

```
git clone [email protected]:jacobbednarz/php-bench.git
```

### Usage

To run the benchmark, you need to include the class into a file and instantiate the class.

```php
report('foo', 'my_method');
$b->report('foo2', 'my_method2');
$b->bench();
```

Expected output:

```
$ php benchmark.php

IDENTIFIER EXECUTION TIME MEMORY USAGE
foo 0.00003099ms 128b
foo2 0.00000906ms 128b
```

### Set the iterations

If you need to perform more iterations than the default (10), you can use `setIterations()` to set the value.

```php
setIterations(1000);
$b->report('foo', 'my_method');
$b->report('foo2', 'my_method2');
$b->bench();
```