note 105832 added to function.realpath
| From: | ldrut at osu1 dot php dot net | Date: | Sun, 18 Sep 2011 19:46:39 +0000 |
| Subject: | note 105832 added to function.realpath | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-183263@lists.php.net to get a copy of this message | ||
@netmosfera, there may be something wrong with your benchmark - possibly you read the directory
names from the filesystem as part of the benchmark and one read from the disk while the other read
from the buffer.
For the following code using
<?php
// $path[] = a recursive list of files from '.', 84 names.
$t0 = microtime(true);
foreach ($a as $k => $path) $a[$k] = $path;
$t1 = microtime(true);
foreach ($a as $k => $path) $a[$k] = realpath($path);
$t2 = microtime(true);
?>
I averaged about 0.033 ms for the first loop and 0.440 ms for the second, 500 times faster than your
test.
Dual Xeon E5620 2.40 GHz Quad Core Processors, CentOS 5.5 Enterprise Linux x86, 12 GB of DDR2 RAM.
Shared server.
----
Server IP: 69.147.83.197
Probable Submitter: 99.152.42.122
----
Manual Page -- http://www.php.net/manual/en/function.realpath.php
Edit -- https://master.php.net/note/edit/105832
Del: integrated -- https://master.php.net/note/delete/105832/integrated
Del: useless -- https://master.php.net/note/delete/105832/useless
Del: bad code -- https://master.php.net/note/delete/105832/bad+code
Del: spam -- https://master.php.net/note/delete/105832/spam
Del: non-english -- https://master.php.net/note/delete/105832/non-english
Del: in docs -- https://master.php.net/note/delete/105832/in+docs
Del: other reasons-- https://master.php.net/note/delete/105832
Reject -- https://master.php.net/note/reject/105832
Search -- https://master.php.net/manage/user-notes.php