note 30495 deleted from function.microtime by didou

From: Date: Mon, 29 Dec 2003 15:20:22 +0000
Subject: note 30495 deleted from function.microtime by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-62636@lists.php.net to get a copy of this message
Note Submitter: jukkissh@hotmail.com ---- A nice benchmark script using microtime =============================== <html><head><title>Speed testing</title></head><body> <?php $run_cycles = 1000; echo "\n<!--\n\n"; $proctime_start=microtime(); # time calculation start-point ################################## # One time executions ################################## for ($pt_count = 0; $pt_count < $run_cycles; $pt_count++) { ################################## # The actual test-cycle ################################## } // for ################################## list($usec_e, $sec_e) = explode(" ",microtime()); # time calculation end-point list($usec_s, $sec_s) = explode(" ",$proctime_start); $proctime_start = $usec_s+$sec_s; $proctime_end = $usec_e+$sec_e; $proctime = $proctime_end-$proctime_start; echo "\n\n-->\n"; echo "\n\nProcessing time: " . substr($proctime,0,7); ?> </body></html> =============================== Remember to adjust $run_cycles if you are running complex scripts. This has proven very usefull when testing different function combinations, which work the best on heavy load.

« previous php.notes (#62636) next »