Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pgrimaud/phpbench
Some personal PHP benchmarks - Very nice! WoW!
https://github.com/pgrimaud/phpbench
benchmarking php php-benchmark phpben
Last synced: about 2 months ago
JSON representation
Some personal PHP benchmarks - Very nice! WoW!
- Host: GitHub
- URL: https://github.com/pgrimaud/phpbench
- Owner: pgrimaud
- License: mit
- Created: 2020-04-03T21:10:37.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-02-13T13:38:49.000Z (11 months ago)
- Last Synced: 2024-05-01T23:16:14.689Z (8 months ago)
- Topics: benchmarking, php, php-benchmark, phpben
- Language: PHP
- Homepage:
- Size: 22.5 KB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# PHPBench
Some PHP benchmarks - Very nice! WoW!Based on [phpbench/phpbench](https://github.com/phpbench/phpbench).
## Installation
```
composer install
```## Usage
Run all tests
```
bin/bench benchmarks
```Run specific test
```
bin/bench benchmarks/GetFirstElementOfArray.php
```## Results
[Get first element of array](https://github.com/pgrimaud/phpbench/blob/master/benchmarks/GetFirstElementOfArray.php)
```shell script
+-------------------+---------+-------+
| subject | mean | diff |
+-------------------+---------+-------+
| benchWithFirstKey | 0.048μs | 1.00x |
| benchWithCurrent | 0.060μs | 1.27x |
| benchWithForeach | 0.065μs | 1.36x |
| benchWithReset | 0.107μs | 2.25x |
+-------------------+---------+-------+
```[Remove last element of tiny array (10 entries)](https://github.com/pgrimaud/phpbench/blob/master/benchmarks/RemoveLastElementOfTinyArray.php)
```shell script
+------------------------------------+---------+-------+
| subject | mean | diff |
+------------------------------------+---------+-------+
| benchWithUnset | 0.117μs | 1.00x |
| benchWithArraySlice | 0.135μs | 1.15x |
| benchWithArrayPop | 0.145μs | 1.24x |
| benchWithArrayReverseAndArrayShift | 0.253μs | 2.17x |
+------------------------------------+---------+-------+
```[Remove last element of large array (10000 entries)](https://github.com/pgrimaud/phpbench/blob/master/benchmarks/RemoveLastElementOfLargeArray.php)
```shell script
+------------------------------------+----------+-------+
| subject | mean | diff |
+------------------------------------+----------+-------+
| benchWithArrayPop | 31.149μs | 1.00x |
| benchWithUnset | 32.279μs | 1.04x |
| benchWithArraySlice | 33.904μs | 1.09x |
| benchWithArrayReverseAndArrayShift | 94.314μs | 3.03x |
+------------------------------------+----------+-------+
```[Create new object](https://github.com/pgrimaud/phpbench/blob/master/benchmarks/CreateNewObject.php) (thanks [@nicolasbonnici](https://github.com/nicolasbonnici))
```shell script
+-------------------------------+---------+-------+
| subject | mean | diff |
+-------------------------------+---------+-------+
| benchWithArrayAndCast | 0.086μs | 1.00x |
| benchWithAnonymousDeclaration | 0.088μs | 1.02x |
| benchWithJsonEncode | 0.114μs | 1.32x |
| benchWithSdtClass | 0.124μs | 1.44x |
+-------------------------------+---------+-------+
```## LICENSE
Licensed under the terms of the MIT License.