USERNAME:
PASSWORD:
Save Info!
Logging in…
This topic is 1 page long.
[ Profile | Posts | Contact ]
Posted at: 5/2/09 09:29 PM
Sign-Up: 02/27/04
Posts: 1,059
How can I test how fast certain code is executed in PHP? For example the time it takes to run a certain loop.
Posted at: 5/2/09 10:00 PM
Sign-Up: 06/26/05
Posts: 3,284
I'm pretty sure there's some timer function, but I can't find it. So, quick fix...
$var1 = microtime(); while (condition) { loop; } $var2 = microtime(); $timeItTook = $var2 - $var1;
Yay pseudocode.
PHP: Main WoogieNoogie.com
Posted at: 5/3/09 05:09 AM
Yes, that seems to work. Thanks.
Posted at: 5/4/09 03:45 PM
Sign-Up: 05/03/02
Posts: 554
You could also use the PEAR Benchmark package - http://pear.php.net/package/Benchmark (a little more involved).
All times are Eastern Standard Time (GMT -5) | Current Time: 11:01 PM
<< Back