PHPackages                             athletic/athletic - 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. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. athletic/athletic

AbandonedLibrary[Debugging &amp; Profiling](/categories/debugging)

athletic/athletic
=================

PHP Benchmarking Framework

v0.1.8(12y ago)295199.3k↑327.8%13[14 issues](https://github.com/polyfractal/athletic/issues)[3 PRs](https://github.com/polyfractal/athletic/pulls)20MITPHPPHP &gt;=5.3.9

Since Jun 14Pushed 10y ago19 watchersCompare

[ Source](https://github.com/polyfractal/athletic)[ Packagist](https://packagist.org/packages/athletic/athletic)[ RSS](/packages/athletic-athletic/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (7)Versions (9)Used By (20)

Athletic
========

[](#athletic)

Athletic is a benchmarking framework. It allows developers to benchmark their code without littering microtime() calls everywhere.

Athletic was inspired by the annotation format that PHPUnit uses. Benchmark tests extend the `AthleticEvent` class and are annotated with specific docblock parameters. The benchmark suite is then run with the Athletic command-line tool.

BranchUnit TestsCoverage[![Latest Stable Version](https://camo.githubusercontent.com/43b7e4c540fe17fb1195cf37a874d9abed65c78ca39c48585f6c7ead616fcbec/68747470733a2f2f706f7365722e707567782e6f72672f6174686c657469632f6174686c657469632f762f737461626c652e706e67)](https://packagist.org/packages/athletic/athletic)[![Build Status](https://camo.githubusercontent.com/df4a6c3a7a6b8bbdf68156ff1c1ce09ad979be1536d07357480221c36ee272ad/68747470733a2f2f7472617669732d63692e6f72672f706f6c796672616374616c2f6174686c657469632e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/polyfractal/athletic)[![Coverage Status](https://camo.githubusercontent.com/4920a40153b51b165674cf7552807724c5e37a7e948afe38893d0d404465010e/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f706f6c796672616374616c2f6174686c657469632f62616467652e706e673f6272616e63683d6d6173746572)](https://coveralls.io/r/polyfractal/athletic?branch=master)WARNING: No longer maintained
=============================

[](#warning-no-longer-maintained)

Athletic is not currently being maintained, so it may have bugs or other problems. I would recommend using [PhpBench](https://github.com/phpbench/phpbench), which was inspired by Athletic. It is far more capable, and actively maintained

### Why Benchmark?

[](#why-benchmark)

Because fast code is good! While *premature* optimization is certainly evil, optimization is always an important component of software development. And sometimes you just really need to see if one solution to a problem is faster than an alternative.

### Why Use Athletic?

[](#why-use-athletic)

Because it makes benchmarking easy! Athletic is built around annotations. Simply create a benchmarking class and annotate a few methods:

```
/**
 * @iterations 1000
 */
public function fastIndexingAlgo()
{
    $this->fast->index($this->data);
}
```

Without Athletic, you have to litter your code with microtime() calls and build timing metrics yourself. Or you end up building a benchmark harness remarkably similar to Athletic (but probably with less syntactic sugar...because who builds throw-away code to read test annotations and fancy output?)

### Why can't I use xDebug?

[](#why-cant-i-use-xdebug)

xDebug is an excellent profiling tool, but it is not a benchmarking tool. xdebug (and by extension, cachegrind) will show you what is fast/slow inside your method, and is indispensable for actually optimizing your code. But it is not useful for running 1000 iterations of a particular function and determining average execution time.

Quick Installation via Composer
-------------------------------

[](#quick-installation-via-composer)

You can easily install Athletic through [Composer](http://getcomposer.org) in two steps:

```
# Install Composer
curl -sS https://getcomposer.org/installer | php

# Add Athletic as a dev dependency
php composer.phar require athletic/athletic:~0.1 --dev
```

You can find out more on how to install Composer, configure autoloading, and other best-practices for defining dependencies at [getcomposer.org](http://getcomposer.org).

Usage
=====

[](#usage)

To begin using Athletic, you must create an **Event**. This is the analog of a PHPUnit Test Case. An Event will benchmark one or more functions related to your code, compile the results and output them to the command line.

Here is a sample Event:

```
