Leeder Posted March 27, 2007 Share Posted March 27, 2007 A while ago I asked which of my two scripts was faster, and someone told me their times to load for 1,000 hits. I was like O.o Where do I get that? So.. Where do I get that? (O.o) (I'd prefer not to download anything if possible x.x) Quote Link to comment https://forums.phpfreaks.com/topic/44541-solved-speed-test/ Share on other sites More sharing options...
per1os Posted March 27, 2007 Share Posted March 27, 2007 <?php for($i=0;$i<1000;$i++) { //execute script here } ?> Quote Link to comment https://forums.phpfreaks.com/topic/44541-solved-speed-test/#findComment-216331 Share on other sites More sharing options...
Leeder Posted March 27, 2007 Author Share Posted March 27, 2007 Oh wow, I never thought of that.. ='( thank you! ...So what about recording the time it takes without a stopwatch and extremely good reflexes? Quote Link to comment https://forums.phpfreaks.com/topic/44541-solved-speed-test/#findComment-216332 Share on other sites More sharing options...
per1os Posted March 27, 2007 Share Posted March 27, 2007 <?php function microtime_float() { $time = microtime(); return (double)substr( $time, 11 ) + (double)substr( $time, 0, 8 ); } $startTime = microtime_float(); for($i=0;$i<1000;$i++) { //execute script here } $endTime = microtime_float(); $totalTime = ($endTime - $startTime); print "It took " . $totalTime . " seconds to run 1,000 times!"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/44541-solved-speed-test/#findComment-216334 Share on other sites More sharing options...
Leeder Posted March 27, 2007 Author Share Posted March 27, 2007 Um.. I'll take your word for it. Quote Link to comment https://forums.phpfreaks.com/topic/44541-solved-speed-test/#findComment-216337 Share on other sites More sharing options...
MadTechie Posted March 27, 2007 Share Posted March 27, 2007 Frost was the microtime_float function written for PHP4 ? as i know PHP5 has microtime_float builtin.. Just wondering Quote Link to comment https://forums.phpfreaks.com/topic/44541-solved-speed-test/#findComment-216375 Share on other sites More sharing options...
per1os Posted March 27, 2007 Share Posted March 27, 2007 I just pulled that from the php user comments. PHP5 added a parameter "get_as_float" that you can use instead of creating an alias function as to say. http://us2.php.net/manual/en/function.microtime.php ChangeLog Version Description 5.0.0 The get_as_float parameter was added =) Quote Link to comment https://forums.phpfreaks.com/topic/44541-solved-speed-test/#findComment-216377 Share on other sites More sharing options...
MadTechie Posted March 27, 2007 Share Posted March 27, 2007 Cool Quote Link to comment https://forums.phpfreaks.com/topic/44541-solved-speed-test/#findComment-216380 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.