PHP code example of iiispikeriii / speedy

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

    

iiispikeriii / speedy example snippets


$speedy = new Speedy();
print $speedy->runTestByName(TestList::PHP_ARR_SORT);

print Speedy::test(TestList::PHP_INC_PREF_POST);

print Speedy::test(TestList::PHP_INC_PREF_POST, [], true);

$params = [ 
    'name' => 'Speedy ++i vs i++',  
    'volumesTest' => [100, 1000, 2000, 3000], 
    'repeatTest' => 5, 
    'viewers' => [ViewerList::VIEWER_TGROUP, ViewerList::VIEWER_TAVG, ViewerList::VIEWER_GBUBLE], 
    'tester' => 'tester' => TesterList::TESTER_PHP
];  
print Speedy::test(TestList::PHP_INC_PREF_POST, $params);

$myFunc1 =  function($size) 
{
    ... custom code ... 
};  
    
$myFunc2 = function($size)  
{
    ... custom code ... 
};  

print Speedy::compare(['nameFunc1' => $myFunc1, 'nameFunc2' => $myFunc2]);  

$params = [ 
    'name' => 'Compare functions',   
    'volumesTest' => [100, 1000, 2000, 3000], 
    'repeatTest' => 5, 
    'viewers' => [ViewerList::VIEWER_TLIST, ViewerList::VIEWER_TGROUP, ViewerList::VIEWER_TAVG, ViewerList::VIEWER_GBUBLE], 
    'tester' => TesterList::TESTER_XHPROF,
];  
print Speedy::compare(['nameFunc1' => $myFunc1, 'nameFunc2' => $myFunc2], $params);