PHPackages                             mookofe/php-benchmark - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mookofe/php-benchmark

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mookofe/php-benchmark
=====================

PHP library that allows you benchmark and compare the performance of functions

420PHPCI failing

Since Aug 10Pushed 5y ago1 watchersCompare

[ Source](https://github.com/mookofe/php-benchmark)[ Packagist](https://packagist.org/packages/mookofe/php-benchmark)[ RSS](/packages/mookofe-php-benchmark/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (2)Used By (0)

mookofe/php-benchmark
=====================

[](#mookofephp-benchmark)

PHP library that allows you benchmark and compare the performance of functions.

[![Latest Stable Version](https://camo.githubusercontent.com/f89f15b93f4ec58d713d1904e97a186c004dc96371855358d9b3cf29270305ff/68747470733a2f2f706f7365722e707567782e6f72672f6d6f6f6b6f66652f7068702d62656e63686d61726b2f762f737461626c65)](https://packagist.org/packages/mookofe/php-benchmark)[![Latest Unstable Version](https://camo.githubusercontent.com/78035353017e1df927613054c223dc0ed230f7587b8c67caaddf75d741f06d2e/68747470733a2f2f706f7365722e707567782e6f72672f6d6f6f6b6f66652f7068702d62656e63686d61726b2f762f756e737461626c65)](https://packagist.org/packages/mookofe/php-benchmark)[![License](https://camo.githubusercontent.com/2e616afc54e01d17ae2a12697bfa2b4ccdbc962554e83efea2066f7c53eac005/68747470733a2f2f706f7365722e707567782e6f72672f6d6f6f6b6f66652f6c61726176656c2d737570706f72742f6c6963656e73652e737667)](https://packagist.org/packages/mookofe/laravel-support)

Features
--------

[](#features)

- Optimize for PHP7
- The library accepts an arbitrary number of user defined functions to test against each other
- Accept functions under test as callable type.
- Accept functions under test with a canonical name
- The library accept an arbitrary number of argument sets to be passed to each function under test.
- Functions can be tested N number of times
- Includes Summary report
- Summary report can be streamed can be sent to an i/o stream in human readable format
- Summary report can be order by (Min, Max, Avg and Median) execution time (Ascending and Descending)
- Report can be filtered by function name and parameters set

Version
-------

[](#version)

0.0.1

Installation
------------

[](#installation)

To get started, use Composer to add the package to your project's dependencies:

```
$ composer require mookofe/php-benchmark

```

Basic Usage:
------------

[](#basic-usage)

```
function bubbleSort(array $array): void
{
    if (!$length = count($array)) {
        return $array;
    }

    for ($outer = 0; $outer < $length; $outer++) {
        for ($inner = 0; $inner < $length; $inner++) {
            if ($array[$outer] < $array[$inner]) {
                $tmp = $array[$outer];
                $array[$outer] = $array[$inner];
                $array[$inner] = $tmp;
            }
        }
    }
}

function quickSort(array $array): void
{
    if (!$length = count($array)) {
        return $array;
    }

    $k = $array[0];
    $x = $y = array();

    for ($i=1;$i
