note 90152 added to function.microtime
| From: | soulmerge at osu1 dot php dot net | Date: | Wed, 08 Apr 2009 09:52:08 +0000 |
| Subject: | note 90152 added to function.microtime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-152943@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 212.124.37.9
Probable Submitter: 78.142.168.126
----
Manual Page -- http://www.php.net/manual/en/function.microtime.php
Edit -- https://master.php.net/note/edit/90152
Del: integrated -- https://master.php.net/note/delete/90152/integrated
Del: useless -- https://master.php.net/note/delete/90152/useless
Del: bad code -- https://master.php.net/note/delete/90152/bad+code
Del: spam -- https://master.php.net/note/delete/90152/spam
Del: non-english -- https://master.php.net/note/delete/90152/non-english
Del: in docs -- https://master.php.net/note/delete/90152/in+docs
Del: other reasons-- https://master.php.net/note/delete/90152
Reject -- https://master.php.net/note/reject/90152
Search -- https://master.php.net/manage/user-notes.php