From:             
Operating system: Windows
PHP version:      5.3.2
Package:          SPL related
Bug Type:         Bug
Bug description:RecursiveDirectoryIterator sucks performance

Description:
------------
On Linux it is really easy to read recursive folder-listings with SPL even
if there are many files and folders, i need here between 1 and 3 seconds
after cold start of the machine on my fedora-box



On Windows the same needs between 180 and 240 seconds and "process
explorer" shows > 1 MB I/O the whole time, same script, same folders
contents, same php-version



WHAT do you do on windows? 

Are you reading all the 30.000 files instead listing them only?

Test script:
---------------
<?php

$files    = array();

$folders  = array();

$spl_objects = new RecursiveIteratorIterator(new
RecursiveDirectoryIterator($path),
RecursiveIteratorIterator::CHILD_FIRST);

try

{

 foreach($spl_objects as $filename=>$spl_object)

 {

  if(DIRECTORY_SEPARATOR === "\\")

  {

   $filename = str_replace(DIRECTORY_SEPARATOR, '/', $filename);

  }

  if(substr($filename, 0, 2) === './')

  {

   $filename = substr($filename, 2);

  }

  switch($spl_object->isDir())

  {

   case false: $files[$filename] = $spl_object->getMTime(); break;

   case true:  $folders[] = $filename; break;

  }

 }

}

catch(UnexpectedValueException $e)

{

 error_log('Directory "' . $path . '" contained a directory we can not
recurse into');

 return false;

}

sort($folders);

ksort($files);

$enumerate_list = array('files'=>$files, 'folders'=>$folders);

unset($folders);

unset($files);

?>

Expected result:
----------------
a normal performance

Actual result:
--------------
waiting minutes to get hughe folder-listings

-- 
Edit bug report at http://bugs.php.net/bug.php?id=51262&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=51262&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=51262&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=51262&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=51262&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=51262&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=51262&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=51262&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=51262&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=51262&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=51262&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=51262&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=51262&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=51262&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=51262&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51262&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51262&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=51262&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=51262&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=51262&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=51262&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=51262&r=mysqlcfg

Reply via email to