vesic / benchmark
Simple utility to measure your execution time.
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/vesic/benchmark
Requires
- phpunit/phpunit: ^6.1
This package is not auto-updated.
Last update: 2025-10-12 08:24:10 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