note 90152 deleted from function.microtime by thiago
| From: | thiago@php.net | Date: | Wed, 08 Apr 2009 11:58:53 +0000 |
| Subject: | note 90152 deleted from function.microtime by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-152952@lists.php.net to get a copy of this message | ||
Note Submitter: soulmerge
----
I ran a small benchmark on microtime() itself to check whether supplying the argument would make any
performance difference. microtime(true) is faster than microtime(false).
<?php
$start = microtime(1);
for ($i = 0; $i < 1000000; $i++) {
microtime(true);
}
echo (microtime(1) - $start)." (micortime(true))\n";
$start = microtime(1);
for ($i = 0; $i < 1000000; $i++) {
microtime(false);
}
echo (microtime(1) - $start)." (micortime(false))\n";
$start = microtime(1);
for ($i = 0; $i < 1000000; $i++) {
microtime();
}
echo (microtime(1) - $start)." (micortime())\n";
?>
These are the results on my box (black macbook/gentoo/PHP 5.2.8-pl2-gentoo):
5.89410400391 (micortime(true))
6.99222111702 (micortime(false))
6.72082686424 (micortime())
Successing runs of the same script verified these results.