PHPackages                             fruit/benchkit - 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. fruit/benchkit

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

fruit/benchkit
==============

Benchmark helper inspired from Golang

1.1.5(9y ago)22472PHP

Since Oct 22Pushed 9y ago1 watchersCompare

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

READMEChangelogDependencies (9)Versions (10)Used By (2)

BenchKit
========

[](#benchkit)

This package is part of Fruit Framework.

BenchKit is set of tools helping you benchmark your program.

[![Build Status](https://camo.githubusercontent.com/0347536b75883b142de983ade2cb229270764321ee4385eed17302fa74de4cf8/68747470733a2f2f7472617669732d63692e6f72672f526f6e6d692f62656e63686b69742e737667)](https://travis-ci.org/Ronmi/benchkit)

Synopsis
--------

[](#synopsis)

See `mybench.php` in `example` folder.

How to write benchmarks
-----------------------

[](#how-to-write-benchmarks)

A benchmark test must be function or public method. It must receive only one parameter with type-hinting.

Organize your benchmarks
------------------------

[](#organize-your-benchmarks)

Benchmarks are grouped by their class. So it's suggested to put different group of benchmarks into different files.

Benchmark function are collected into an unnamed group.

Command line helper
-------------------

[](#command-line-helper)

`bench` is command line benchmark runner. It will scan specified directory recursivly, find out all benchmark functions, and run. For example:

```
bench run example
```

Thanks to [CLIFramework](https://github.com/c9s/CLIFramework), you can run `bench help run` to see supported command line arguments.

`bench` does not support construct arguments, you have to write your own benchmark executor to register benchmarks and run it.

### XHProf

[](#xhprof)

You can gather xhprof data when running benchmarks with default command line runner by

- enable `--xhprof` option and
- use `Fruit\BenchKit\Formatter\XhprofSummary` summary formatter.

### Passing constructor arguments to formatter

[](#passing-constructor-arguments-to-formatter)

You can pass a string as constructor argument to formatter with `--sa` and `--pa` options.

### Generate multiple summary without running benchmarks several times

[](#generate-multiple-summary-without-running-benchmarks-several-times)

Use `Fruit\BenchKit\Formatter\ChainSummary`, and pass constructor argument to specify what formatters you want.

```
bench run -s 'Fruit\BenchKit\Formatter\ChainSummary' --sa '{"chain":["Fruit\\BenchKit\\Formatter\\HighChartSummary":"{\"type\":\"time\"}", "Fruit\\BenchKit\\Formatter\\XhprofSummary":""]}' -p 'Fruit\BenchKit\Formatter\NullProgressLogger' example > /tmp/chart.html
```

Beware about shell escaping and php string escaping because builtin formatters accepts argument in JSON format. Use `--argdebug` when in doubt.

License
-------

[](#license)

Any version of MIT, GPL or LGPL.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity69

Established project with proven stability

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

Recently: every ~100 days

Total

9

Last Release

3456d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1ef743a4ba2b41bc6643ca3c4d71f4608abee7dc617efa09b18e3fa0a44aeda8?d=identicon)[Ronmi](/maintainers/Ronmi)

---

Top Contributors

[![Ronmi](https://avatars.githubusercontent.com/u/59556?v=4)](https://github.com/Ronmi "Ronmi (30 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/fruit-benchkit/health.svg)

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

###  Alternatives

[symfony/property-access

Provides functions to read and write from/to an object or array using a simple string notation

2.8k295.3M2.5k](/packages/symfony-property-access)[corneltek/assetkit

High performance asset manager.

531.4k3](/packages/corneltek-assetkit)

PHPackages © 2026

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