Skip to content

hik200/speedy

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Speed testing any functions

Install

composer require iiispikeriii/speedy

Use

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

if you want to get only result speed testing - use onlyData param its true

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

OR

$params = [ 
    'name' => 'Speedy ++i vs i++',  
    'valueTest' => [100, 1000, 2000, 3000], 
    'qntTest' => 5, 
    'viewers' => [TestCore::VIEWER_TGROUP, TestCore::VIEWER_TAVG, TestCore::VIEWER_GBUBLE], 
    'tester' => ['name' => TestCore::TESTER_PHP], or 'tester' => TestCore::TESTER_PHP
];  
print Speedy::test(Speedy::PHP_INC_PREF_POST, $params);

Viewers

  • TestCore::VIEWER_TLIST - table list result
  • TestCore::VIEWER_TGROUP - table group result
  • TestCore::VIEWER_TAVG - table average result
  • TestCore::VIEWER_GBUBLE - graph with buble result

Tests

  • Speedy::PHP_INC_PREF_POST - comparison with pre-increment postincrement (++i and i++)

Testers

  • TestCore::TESTER_PHP - testing with PHP functions microtime and memory_get_usage
  • TestCore::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)

Compare custom functions

$myFunc1 =  function($size) 
{
    ... custom code ... 
};  
    
$myFunc2 = function($size)  
{
    ... custom code ... 
};  
print Speedy::compare(['nameFunc1' => $myFunc1, 'nameFunc2' => $myFunc2]);  

OR

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

Example viwers

VIEWER_TLIST

"table data list viewer"

VIEWER_TGROUP

"table data group viewer"

VIEWER_TAVG

"table data group viewer"

VIEWER_GBUBLE

"graph data buble viewer"

About

speed tests for any platform

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%