PDA

View Full Version : [REL][Simple] Benchmarking Functions



0x00
23-07-2011, 02:01 AM
http://pastebin.com/fUjyXH9J

This is part of the package, the full package will be available soon!

Simple application using it:

<?php
$b = singleton::instance('\benchmark\tools');
for($i = 0; $i != 1000; $i++)
{
$b->start();
echo 'hello ';
$b->stop();
echo 'in ' . $b->end(5) . '<br/>'; # 5 decimal places.
$b->flush();
}


Or with the new update instead of


$b->stop();
echo 'in ' . $b->end(5) . '<br/>';


You could have:


echo 'in ' . $b->stop()->end(5) . '<br/>';

!! How cool! Function chaining!

Remember you don't have to flush! You can keep it in the functions variables. Just remember to use singleton! We don't want to be starting multiple timers now, do we?

Want to hide these adverts? Register an account for free!