https://github.com/jacobbednarz/php-bench
Benchmarking PHP, the easy way
https://github.com/jacobbednarz/php-bench
Last synced: 7 months ago
JSON representation
Benchmarking PHP, the easy way
- Host: GitHub
- URL: https://github.com/jacobbednarz/php-bench
- Owner: jacobbednarz
- Created: 2014-11-17T08:46:16.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-02-02T04:04:48.000Z (almost 11 years ago)
- Last Synced: 2025-03-31T04:34:00.198Z (8 months ago)
- Language: PHP
- Size: 180 KB
- Stars: 13
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-wpo - php-bench - Benchmark and profile PHP code blocks whilst measuring the performance footprint. (Benchmark - PHP / Meetups)
- fucking-awesome-wpo - php-bench - Benchmark and profile PHP code blocks whilst measuring the performance footprint. (Benchmark - PHP / Meetups)
README
# PHP Benchmark - The easy way
This is designed to make benchmarking PHP easy.
### Installation
```
git clone git@github.com: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();
```