PHP code example of nochso / benchmark

1. Go to this page and download the library: Download nochso/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/ */

    

nochso / benchmark example snippets


$report = new Report('My report name');
$unit = new Unit('Encryption speed');
$unit->addClosure(function ($n) {
    while ($n--) {
        $x = str_rot13('secret');
    }
}, 'rot13');
$unit->addClosure(function ($n) {
    while ($n--) {
        $x = str_rot13(str_rot13('secret'));
    }
}, 'rot26');
$report->unitList->add($unit);
$report->run();

public function __construct($title, $description = '', $config = array())

array(
    'template_dir' => 'template',
    'output_dir'   => 'build',
    'twig'         => array(
        'cache'            => 'cache/twig',
        'auto_reload'      => true,
        'strict_variables' => true,
    ),
)

\nochso\Benchmark\Timer::$defaultMinDuration = 1000;