vesic/benchmark

Simple utility to measure your execution time.

Maintainers

Package info

github.com/dusan-vesic-devtech/benchmark

pkg:composer/vesic/benchmark

Statistics

Installs: 8

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.0.1 2017-05-17 13:49 UTC

This package is not auto-updated.

Last update: 2026-03-15 10:22:42 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