stk2k/bench

Simple benchmark classes

0.2.1 2021-06-05 17:17 UTC

This package is auto-updated.

Last update: 2024-05-05 23:46:54 UTC


README

Latest Version on Packagist Software License Build Status Coverage Status Code Climate Total Downloads

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

MIT

Author

stk2k

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.