PHPackages                             tankfairies/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. tankfairies/benchmark

ActiveLibrary

tankfairies/benchmark
=====================

benchmark code

1.3(2y ago)071MITPHPPHP ^8.2

Since Mar 19Pushed 1y ago1 watchersCompare

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

READMEChangelog (4)Dependencies (4)Versions (5)Used By (1)

[![Latest Stable Version](https://camo.githubusercontent.com/2e65f6b140fabd7d0739ada2ba71d75c073d3c24cd3216e6c9a299f8b7c657b1/68747470733a2f2f706f7365722e707567782e6f72672f74616e6b666169726965732f62656e63686d61726b2f762f737461626c65)](https://packagist.org/packages/tankfairies/benchmark)[![Total Downloads](https://camo.githubusercontent.com/bdb737e14201db3629c7aacba9b67d91d3376285d5e5f08f0914ef692b829985/68747470733a2f2f706f7365722e707567782e6f72672f74616e6b666169726965732f62656e63686d61726b2f646f776e6c6f616473)](https://packagist.org/packages/tankfairies/benchmark)[![Latest Unstable Version](https://camo.githubusercontent.com/b688258ba321c199b9fc411121042900a2960d58634f2ce46e1401291c41c9c0/68747470733a2f2f706f7365722e707567782e6f72672f74616e6b666169726965732f62656e63686d61726b2f762f756e737461626c65)](https://packagist.org/packages/tankfairies/benchmark)[![License](https://camo.githubusercontent.com/595d2e88345bf2977afbef1c1fcb100ed51ad760b33d20e1266c496c90e9fd62/68747470733a2f2f706f7365722e707567782e6f72672f74616e6b666169726965732f62656e63686d61726b2f6c6963656e7365)](https://packagist.org/packages/tankfairies/benchmark)[![Build Status](https://camo.githubusercontent.com/e37c7749ee3fbb54b7842231033b0f9d85e79efb4c33da35b4da662204f8a6e2/68747470733a2f2f6170702e7472617669732d63692e636f6d2f74616e6b666169726965732f62656e63686d61726b2e7376673f746f6b656e3d4647786645576163356d4e6267464c376d385550266272616e63683d6d61696e)](https://app.travis-ci.com/tankfairies/benchmark)

Benchmark
=========

[](#benchmark)

Provides the ability to do simple performance tests on code blocks.

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

[](#installation)

Install with [Composer](https://getcomposer.org/):

```
composer require tankfairies/benchmark
```

Usage
-----

[](#usage)

### Server Details

[](#server-details)

This will output an array of basic details on the machine you're running performance testing on.

For server details: -

```
$server = new Server();
$details = $server->getDetails();
```

Output Example: -

```
Array (
    [PHP] => 8.2.16
    [Platform] => Darwin
    [Arch] => arm64
    [Max memory usage] => 128M
    [OPCache status] => disabled
    [OPCache JIT] => disabled/unavailable
    [PCRE JIT] => enabled
    [XDebug extension] => disabled
)
```

For installed extensions: -

```
$server = new Server();
$extensions = $server->getInstalledExtensions();
```

Output Example: -

```
Array
(
    [0] => Core
    [1] => date
    [2] => libxml
    [3] => openssl
    [4] => pcre
    [5] => sqlite3
    [6] => zlib
    [7] => bcmath
    ...
```

### Stopwatch

[](#stopwatch)

Handles the time recording for benchmarking.

### Benchmark

[](#benchmark-1)

Call or place the code you want to test into an anonymous function, for example: -

```
$func = function () {
    rand(1, 100000);
};
```

Setup the benchmark as below: -

```
$benchmark = new Benchmark(new Stopwatch());
$completion = $benchmark
    ->multiplier(200000, 5)
    ->script($func)
    ->run();
```

You can define your own run criteria for example the above will run the test 200000 times for a total of 5 loops. This will produce 5 sets of results in seconds in the format: -

```
Array (
    [1] => 0.1699
    [2] => 0.1642
    [3] => 0.1641
    [4] => 0.1643
    [5] => 0.1645
)
```

The above shows the execution time in seconds for each 200k run.

Copyright and license
---------------------

[](#copyright-and-license)

The tankfairies/benchmark library is Copyright (c) 2019 Tankfairies () and licensed for use under the MIT License (MIT).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

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 ~0 days

Total

4

Last Release

781d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/761e80f0c4632541e235d7d45128d65ace90c65e3c799c11c36a120155eaad58?d=identicon)[tankfairies](/maintainers/tankfairies)

---

Top Contributors

[![tankfairies](https://avatars.githubusercontent.com/u/50480804?v=4)](https://github.com/tankfairies "tankfairies (6 commits)")

---

Tags

benchmark

###  Code Quality

TestsCodeception

### Embed Badge

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

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

###  Alternatives

[devster/ubench

Micro PHP library for benchmarking

5701.0M29](/packages/devster-ubench)[gotzmann/comet

Modern PHP framework for building blazing fast REST APIs and microservices

68816.2k1](/packages/gotzmann-comet)[christophrumpel/artisan-benchmark

Benchmark Artisan Commands

17966.6k](/packages/christophrumpel-artisan-benchmark)[dragon-code/benchmark

Simple comparison of code execution speed between different options

11934.7k5](/packages/dragon-code-benchmark)[ayesh/php-timer

High-resolution and monotonic stop-watch for all your needs. Supports timer start, pause, resume, stop, read, and minimal conversion.

22226.4k11](/packages/ayesh-php-timer)[phpbenchmark/phpbenchmark

Easy to use benchmark toolkit for your PHP-application. This library contains classes for comparing algorithms as well as benchmarking application responses

8011.4k2](/packages/phpbenchmark-phpbenchmark)

PHPackages © 2026

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