PHP code example of vesic / benchmark
1. Go to this page and download the library: Download vesic/benchmark library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
vesic / benchmark example snippets
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);