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)

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay