vesic/benchmark

Simple utility to measure your execution time.

0.0.1 2017-05-17 13:49 UTC

This package is not auto-updated.

Last update: 2025-06-08 06:39:32 UTC


README

Benchmark your code

Installation

composer require vesic/benchmark

Basic Usage

require __DIR__ . '/vendor/autoload.php';

use Vesic\Benchmark\Benchmark;

$benchmark = new Benchmark;

$bencmark->run(function() {
    for ($i=0; $i<1e6; $i++) { }
});

function yourFunctionToMeasure() {
    // expensive computing
}

$benchmark->run('yourFunctionToMeasure');

function functionWithParams($param) {
    for ($i=0; $i<$param; $i++) { }
}

$benchmark->run('functionWithParams', 1e6);

Output

Your code performance:
Time - 0.017. Memory - 356.75 kb