stk2k / bench
Simple benchmark classes
Installs: 1 236
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.2
- stk2k/util: ~0.1
Requires (Dev)
- php-coveralls/php-coveralls: ^2.0
- phpunit/phpunit: ^8.5.15
This package is auto-updated.
Last update: 2024-12-06 00:58:09 UTC
README
Description
Simple benchmark classes
Feature
Demo
Exsample 1: time benchmark shorthand
use Stk2k\Bench\TimeBenchmark; $handle = TimeBenchmark::start(); // benchmark target code here $score = TimeBenchmark::score($handle); echo 'score: ' . $score . ' msec';
Exsample 2: memory benchmark shorthand
use Stk2k\Bench\MemoryBenchmark; $handle = MemoryBenchmark::start(); // benchmark target code here $score = MemoryBenchmark::score($handle); $score = array_map(function($v){ return $v . 'MB'; }, $score); echo 'score: ' . print_r($score, true);
Usage
Requirement
PHP 7.2 or later
Installing stk2k/bench
The recommended way to install stk2k/bench is through Composer.
composer require stk2k/bench
After installing, you need to require Composer's autoloader:
require 'vendor/autoload.php';
License
Author
Disclaimer
This software is no warranty.
We are not responsible for any results caused by the use of this software.
Please use the responsibility of the your self.