note 105832 deleted from function.realpath by danbrown
| From: | danbrown@php.net | Date: | Sun, 18 Sep 2011 20:38:51 +0000 |
| Subject: | note 105832 deleted from function.realpath by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-183264@lists.php.net to get a copy of this message | ||
Note Submitter: ldrut
----
@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.