PHPackages                             nochso/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. [Testing &amp; Quality](/categories/testing)
4. /
5. nochso/benchmark

ActiveLibrary[Testing &amp; Quality](/categories/testing)

nochso/benchmark
================

Benchmark with reliable results

0.5.3(10y ago)01221ISCPHP

Since Sep 25Pushed 10y ago1 watchersCompare

[ Source](https://github.com/nochso/Benchmark)[ Packagist](https://packagist.org/packages/nochso/benchmark)[ RSS](/packages/nochso-benchmark/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (12)Versions (11)Used By (1)

nochso/benchmark library
========================

[](#nochsobenchmark-library)

[![Latest Stable Version](https://camo.githubusercontent.com/6f673812d16f571c3b279f39712cc06713eabc5ae5e8efdbfb3723a3a0c7d127/68747470733a2f2f706f7365722e707567782e6f72672f6e6f6368736f2f62656e63686d61726b2f762f737461626c65)](https://packagist.org/packages/nochso/benchmark)[![License](https://camo.githubusercontent.com/a51604bf6dd3b3777b935a8d7add5486867edd3ee398b87973e4692691e4fd76/68747470733a2f2f706f7365722e707567782e6f72672f6e6f6368736f2f62656e63686d61726b2f6c6963656e7365)](LICENSE)

nochso/benchmark creates pretty HTML benchmarks from any closures you supply:

- Generate HTML reports including Github flavoured Markdown
- Reliably compare different algorithms
- Run tests for a minimum amount of time to ensure stable results

[**View an example report**](http://nochso.github.io/Benchmark/reports/search.html)

[**View the API documentation**](http://nochso.github.io/Benchmark/docs/nochso/Benchmark.html)

- [Installation](#installation)
- [Usage](#usage)
- [Contributing](#contributing)
- [History](#history)
- [Credits](#credits)
- [License](#license)

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

[](#installation)

1. Install composer on Linux / Unix / OSX or Windows
2. Require this package via composer:

    ```
    composer require nochso/benchmark
    ```

Usage
-----

[](#usage)

Have a look at the [example reports](reports/).

A very simple example without parameters:

```
$report = new Report('My report name');
$unit = new Unit('Encryption speed');
$unit->addClosure(function ($n) {
    while ($n--) {
        $x = str_rot13('secret');
    }
}, 'rot13');
$unit->addClosure(function ($n) {
    while ($n--) {
        $x = str_rot13(str_rot13('secret'));
    }
}, 'rot26');
$report->unitList->add($unit);
$report->run();
```

This will generate and save a HTML report to folder `build` by default.

### Options

[](#options)

The Report constructor takes an optional third argument `$config`:

```
public function __construct($title, $description = '', $config = array())
```

If omitted, default options will be used. Otherwise your configuration will be merged with the defaults.

```
array(
    'template_dir' => 'template',
    'output_dir'   => 'build',
    'twig'         => array(
        'cache'            => 'cache/twig',
        'auto_reload'      => true,
        'strict_variables' => true,
    ),
)
```

You can also change the minimum duration of tests which defaults to 1000 millseconds (1 second):

```
\nochso\Benchmark\Timer::$defaultMinDuration = 1000;
```

Contributing
------------

[](#contributing)

1. [Open an issue](https://github.com/nochso/benchmark/issues/new) if it's worth discussing.
2. Fork this project on Github.
3. Clone your fork: `git clone git@github.com:yourname/benchmark.git`
4. Don't forget to `composer update`
5. Create your feature branch: `git checkout -b my-new-feature`
6. Commit your changes: `git commit -am 'Add some feature'`
7. Push to the branch: `git push origin my-new-feature`
8. Submit a pull request on Github :)

Change log
----------

[](#change-log)

See [CHANGELOG](CHANGELOG.md).

Credits
-------

[](#credits)

- [Marcel Voigt](https://github.com/nochso)

License
-------

[](#license)

This project is licensed under the ISC license which is MIT/GPL compatible and FSF/OSI approved:

```
Copyright (c) 2015, Marcel Voigt

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~29 days

Recently: every ~48 days

Total

8

Last Release

3681d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6887618?v=4)[Marcel Voigt](/maintainers/nochso)[@nochso](https://github.com/nochso)

---

Top Contributors

[![nochso](https://avatars.githubusercontent.com/u/6887618?v=4)](https://github.com/nochso "nochso (107 commits)")

---

Tags

testingperformanceoptimizationbenchmarktiming

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nochso-benchmark/health.svg)

```
[![Health](https://phpackages.com/badges/nochso-benchmark/health.svg)](https://phpackages.com/packages/nochso-benchmark)
```

###  Alternatives

[phpbench/phpbench

PHP Benchmarking Framework

2.0k13.0M627](/packages/phpbench-phpbench)[infection/infection

Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to measure the effectiveness of a test set in terms of its ability to detect faults.

2.2k26.2M1.8k](/packages/infection-infection)[dama/doctrine-test-bundle

Symfony bundle to isolate doctrine database tests and improve test performance

1.2k37.2M144](/packages/dama-doctrine-test-bundle)[phpspec/phpspec

Specification-oriented BDD framework for PHP 7.1+

1.9k36.7M3.1k](/packages/phpspec-phpspec)[magento/magento2-functional-testing-framework

Magento2 Functional Testing Framework

15511.5M30](/packages/magento-magento2-functional-testing-framework)[ta-tikoma/phpunit-architecture-test

Methods for testing application architecture

10745.9M13](/packages/ta-tikoma-phpunit-architecture-test)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
