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) 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 } ?> 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? 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!"; ?> 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. 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 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 =) 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 Link to comment https://forums.phpfreaks.com/topic/44541-solved-speed-test/#findComment-216380 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.