DEV Community

loading...

Test , test ,test it again

maddrid
・1 min read

My fist package

First i needed to benchmark my php application.
Then i came up with this..
Link https://packagist.org/packages/maddrid/bench.
Simple usage .

Bench::start ('first');
 for($i=5;$i<3222200;$i++){
     if ($i==2232){
         Bench::start('22');
          \random_int(0, 1000);
     }
     $v = $i*32/18;

 }
 Bench::stop('22');
 Bench::stop('first');

 Bench ::printTimers ();

output

Array
(
    [first] => Array
        (
            [cpu_load] => Not enabled
            [duration] => 0.16000104
            [memory] => 752 b
            [peak] => 539.52 kb
        )

    [22] => Array
        (
            [cpu_load] => Not enabled
            [duration] => 0.16000104
            [memory] => NAN b
            [peak] => 539.52 kb
        )

)

Not a big deal but made with love and a lot of coffee !!!

Discussion (0)