#44056 [Opn->Fbk]: Get file content
ID: 44056
Updated by: felipe@php.net
Reported By: raphpell at cario dot fr
-Status: Open
+Status: Feedback
Bug Type: Performance problem
Operating System: Windows Vista
PHP Version: 5.2.5
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows (zip):
http://snaps.php.net/win32/php5.2-win32-latest.zip
For Windows (installer):
http://snaps.php.net/win32/php5.2-win32-installer-latest.msi
Previous Comments:
------------------------------------------------------------------------
[2008-02-06 18:13:54] raphpell at cario dot fr
$_ENV [ 'nFiles' ] = 0 ;
$_ENV [ 'nFolders' ] = 0 ;
$sPath = $prefixe . './' ; // define a file system
function _getmicrotime ( ) {
list ( $usec, $sec ) = explode ( " " , microtime ( )) ;
return ( ( (float) $usec + (float) $sec ) * 1000 ) ;
};
function doSomething ( $sPath ) {
$_ENV [ "nFolders" ]++ ;
$a = glob ( $sPath . "*" ) ;
if ( $a )
while ( list (, $sFile ) = each ( $a )){
if ( is_dir ( $sFile ) AND ! in_array ( $sFile , Array ( "." , ".."
)))
doSomething ( $sFile . "/" ) ;
if ( is_file ( $sFile )){
$s = file_get_contents ( $sFile ) ;
$_ENV [ "nFiles" ]++ ;
}
}
};
$nStart = _getmicrotime ( ) ;
if ( is_dir ( $sPath )) doSomething ( $sPath ) ; else die ( $sPath ) ;
echo
' - time: '. (int)( _getmicrotime ( ) - $nStart ) . 'ms ' .
' - Files: '. $_ENV [ "nFiles" ] .
' - Folders: '. $_ENV [ "nFolders" ] ;
/*
EXECUTION TIME
[PHP 4.3.10]
2848.597 ms
2915.554 ms
2798.933 ms
[PHP 5.2.5]
11469.610 ms
11199.461 ms
11227.722 ms
*/
------------------------------------------------------------------------
[2008-02-06 08:13:10] derick@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[2008-02-05 22:45:45] raphpell at cario dot fr
Description:
------------
I handle my filesy stem :
- 2000 files
- 2000 folders
With PHP 4.3.3 my scripts take 5 secondes
With PHP 5.2.5 35 secondes...
I use fopen, file_get_contents ( ob_start + include )
I zip my site, create my db with my filesystem,...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44056&edit=1
Thread (4 messages)