Callister Posted April 21, 2008 Share Posted April 21, 2008 Greetings everyone, I'm in the process of optimizing code that is significantly old that was programmed in my lesser years. I have learned a lot about better ways of doing things, however I have a question. What is the best way to benchmark optimization progress? Is there a variable or any way I can configure to see if a script is in actuality more efficient [rather than just looking nicer]? Thanks guys! Call Link to comment https://forums.phpfreaks.com/topic/102178-php-optimization-techniques/ Share on other sites More sharing options...
Barand Posted April 21, 2008 Share Posted April 21, 2008 <?php $t1 = microtime(true); // method A $t2 = microtime(true); // method B $t3 = microtime(true); printf ('Method A - %0.5f secs<br>', $t2-$t1); printf ('Method B - %0.5f secs<br>', $t3-$t2); ?> Link to comment https://forums.phpfreaks.com/topic/102178-php-optimization-techniques/#findComment-523052 Share on other sites More sharing options...
DarkWater Posted April 21, 2008 Share Posted April 21, 2008 <?php $t1 = microtime(true); // method A $t2 = microtime(true); // method B $t3 = microtime(true); printf ('Method A - %0.5f secs<br>', $t2-$t1); printf ('Method B - %0.5f secs<br>', $t3-$t2); ?> Or, use the Timer class from PEAR. Works quite well. Link to comment https://forums.phpfreaks.com/topic/102178-php-optimization-techniques/#findComment-523054 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.