2017 © Pedro Peláez
 

library speedy

testing speed for any platform

image

iiispikeriii/speedy

testing speed for any platform

  • Tuesday, January 10, 2017
  • by IIISpikerIII
  • Repository
  • 2 Watchers
  • 4 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Speed testing any functions

It`s util for easy performance testing some functions., (*1)

Install

composer require iiispikeriii/speedy

Use

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

OR, (*2)

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

if you want to get only result speed testing - use onlyData param its true, (*3)

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

OR, (*4)

$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);

Viewers

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

Tests

  • 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, Quick
  • TestList::PHP_SOF_VS_COUNT - comparison with sizeof() versus count()

Testers

  • TesterList::TESTER_PHP - testing with PHP functions microtime and memory_get_usage
  • TesterList::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 ... 
};  

every custome functions should take int parameter - workload from volumesTest, (*5)

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

OR, (*6)

$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);

Example viwers

VIEWER_TLIST, (*7)

"table data list viewer", (*8)

VIEWER_TGROUP, (*9)

"table data group viewer", (*10)

VIEWER_TAVG, (*11)

"table data group viewer", (*12)

VIEWER_GBUBLE, (*13)

"graph data buble viewer", (*14)

The Versions

10/01 2017

dev-master

9999999-dev

testing speed for any platform

  Sources   Download

MIT

The Requires

 

by Nikita Zorin

testing speed

10/01 2017

dev-develop

dev-develop

testing speed for any platform

  Sources   Download

MIT

The Requires

 

by Nikita Zorin

testing speed

23/08 2016

0.1.0

0.1.0.0

testing speed for any platform

  Sources   Download

The Requires

 

by Nikita Zorin

testing speed