DEV Community

maddrid
maddrid

Posted on

3

Test , test ,test it again

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 !!!

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay