https://github.com/asika32764/php-simple-benchmark
PHP Simple Benchmark framework
https://github.com/asika32764/php-simple-benchmark
benchmark benchmark-framework php
Last synced: 10 months ago
JSON representation
PHP Simple Benchmark framework
- Host: GitHub
- URL: https://github.com/asika32764/php-simple-benchmark
- Owner: asika32764
- Created: 2015-06-04T13:49:15.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2023-10-28T12:48:37.000Z (over 2 years ago)
- Last Synced: 2025-04-13T06:11:32.685Z (10 months ago)
- Topics: benchmark, benchmark-framework, php
- Language: PHP
- Homepage: https://packagist.org/packages/asika/simple-benchmark
- Size: 26.4 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PHP Simple Benchmark CLI
## Installation via Composer
``` bash
composer global require asika/simple-benchmark
```
## Getting Started
Type `benchmark` or `sb` in terminal.
``` bash
sb
```
The output will be:
```
PHP Simple Benchmark Framework - version: 2.0.0-beta
------------------------------------------------------------
[sb Help]
Help of Simple Benchmark.
Usage:
sb [option]
Options:
-h | --help Display this help message.
-q | --quiet Do not output any message.
-v | --verbose Increase the verbosity of messages.
--ansi Set 'off' to suppress ANSI colors on unsupported terminals.
Commands:
run Run benchmark
create Create a task file.
Use `benchmark create TaskName` to generate a new task sample file to /tasks folder.
Use `benchmark run TaskFile.php [times]` to run benchmark
```
### Create a Task File
```bash
sb create TaskName
```
A file named `TaskName.php` will be generated to current folder.
Open `TaskName.php` you will see:
```php
addTask('task1-md5', function() {
md5(uniqid());
});
$benchmark->addTask('task2-sha1', function() {
sha1(uniqid());
});
```
### Run Benchmark
Run benchmark by this command:
``` bash
sb run TaskName.php
```
The output will be:
```
Benchmark Result
---------------------------------------------
Run 10,000 times
task1-md5:
- Time: 0.0104s
- Memory: 2048kb
task2-sha1:
- Time: 0.0101s
- Memory: 2048kb
```
You can set times (Default is 10000) at second argument:
``` bash
php benchmark run TaskName.php 15000
```