PHPackages                             serhiikorniushov/micro-bench - 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. serhiikorniushov/micro-bench

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

serhiikorniushov/micro-bench
============================

PHP Micro Benchmarking tool

0.0.1(1y ago)010MITPHPPHP ^5.4 || ^5.5 || ^5.6 || ^7.0 || ^7.1 || ^7.2 || ^7.3 || ^7.4 || ^8.0 || ^8.1 || ^8.2 || ^8.3 || 8.4

Since Feb 14Pushed 1y ago1 watchersCompare

[ Source](https://github.com/SergeC/micro-bench)[ Packagist](https://packagist.org/packages/serhiikorniushov/micro-bench)[ RSS](/packages/serhiikorniushov-micro-bench/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

MicroBench
==========

[](#microbench)

MicroBench is a simple PHP tool for micro-benchmarking your code developed by Serhii Korniushov. It measures execution time, memory usage, and memory peak usage. It supports high-resolution time (hrtime) on PHP 7.3+.

Features
--------

[](#features)

- Measures elapsed time (microtime and hrtime).
- Tracks memory usage and peak memory usage.
- Simple API: `start()`, `finish()`, `getReport()`.
- Easy to install with Composer.
- Provides human-readable time formatting.

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

[](#installation)

Install MicroBench using Composer:

```
composer require --dev serhiikorniushov/micro-bench
```

This command will download the MicroBench library and its dependencies into your project's `vendor` directory.

Usage
-----

[](#usage)

Here's a basic example of how to use MicroBench:

```
