hoaproject / Bench

The Hoa\Bench library.

Home Page:https://hoa-project.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

If the execution is < 1ms then global > 100 %

maitrepylos opened this issue · comments

Sample :

use Hoa\Bench;


$tab = \SplFixedArray::fromArray(['Gg', 'est', 'le', 'plus', 'beau']);

$bench = new Bench();

$bench->one->start();

for($i=0;$i<$tab->count();$i++){

    echo $tab[$i];

}

$bench->one->stop();


$bench->two->start();

//le foreach

foreach($tab as $value){

    echo $value;
}

$bench->two->stop();


echo $bench;

Result :

global |||||||||||||||||||||||||||||||||||||||||||||||||||||| 0ms, 104.1%
one |||||||||||||||||||||| 0ms, 43.2%
two |||||||||| 0ms, 19.1%

commented

I suggest adding pause() and resume(). Then getStatistic() will call these methods to loop on paused Marks.