It`s util for easy performance testing some functions.
composer require iiispikeriii/speedy
$speedy = new Speedy();
print $speedy->runTestByName(TestList::PHP_ARR_SORT);OR
print Speedy::test(TestList::PHP_INC_PREF_POST);if you want to get only result speed testing - use onlyData param its true
print Speedy::test(TestList::PHP_INC_PREF_POST, [], true);OR
$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);ViewerList::VIEWER_TLIST- table list resultViewerList::VIEWER_TGROUP- table group resultViewerList::VIEWER_TAVG- table average resultViewerList::VIEWER_GBUBLE- graph with buble result
TestList::PHP_INC_PREF_POST- comparison with pre-increment postincrement (++i and i++)TestList::PHP_ARR_READ- comparison with reading array "while" "for" "foreach"TestList::PHP_ARR_SORT- comparison with sorting arrays Heap, Bubble, Select, Insertion, QuickTestList::PHP_SOF_VS_COUNT- comparison with sizeof() versus count()
TesterList::TESTER_PHP- testing with PHP functions microtime and memory_get_usageTesterList::TESTER_XHPROF- testing with extention XHProf, required XHProf.- xhprof_lib - path to xhprof_lib.php (not required)
- xhprof_runs - path to xhprof_runs.php (not required)
$myFunc1 = function($size)
{
... custom code ...
};
$myFunc2 = function($size)
{
... custom code ...
}; every custome functions should take int parameter - workload from volumesTest
print Speedy::compare(['nameFunc1' => $myFunc1, 'nameFunc2' => $myFunc2]); OR
$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);VIEWER_TLIST
VIEWER_TGROUP
VIEWER_TAVG
VIEWER_GBUBLE



