|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44505 include_once behavior when including UNC file
Submitted: 2008-03-22 17:53 UTC Modified: 2008-08-06 01:00 UTC
Avg. Score:4.9 ± 0.4
Reproduced:19 of 19 (100.0%)
Same Version:16 (84.2%)
Same OS:19 (100.0%)
From: lmeyer at ea dot com Assigned: dmitry (profile)
Status: No Feedback Package: Performance problem
PHP Version: 5.2CVS-2008-03-25 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: lmeyer at ea dot com
New email:
PHP Version: OS:


 [2008-03-22 17:53 UTC] lmeyer at ea dot com
When using include_once with an abolute UNC file path, it is really slow using php 5.2.5, php 5.2.4, and really fast using php 5.2.3

From the script below :
PHP 5.2.5 :
first include_once : //NAS/nas/www/adodb5/
time (ms): 0.068962097167969
include_once count in 5 sec: 240   <<<<<<<<<<

PHP 5.2.3 :
first include_once : //NAS/nas/www/adodb5/
time (ms): 0.030542135238647
include_once count in 5 sec: 376054 <<<<<<<<<<

Thanks !

Reproduce code:
$absolutepath = '//NAS/nas/www/adodb5/';
$durationsec = 5.0;
function sys_sinternal_microtime_float()
    list($usec, $sec) = explode(" ", microtime());
    return ((float)$usec + (float)$sec);
$t = sys_sinternal_microtime_float();
$t = sys_sinternal_microtime_float() - $t;
echo 'first include_once : '.$absolutepath.'<br>';
echo 'time (ms): '.$t.'<br>';

$cnt  = 0;
$t = sys_sinternal_microtime_float();
while(sys_sinternal_microtime_float() - $t < $durationsec)
echo 'include_once count in '.$durationsec.' sec: '.$cnt;
echo '<br>';

Expected result:
"Include_once" should include_once should only include a file once whitout doing extra processing as long as the file has an absolute path.

Actual result:
It's wotking well with php 5.2.3, but not anymore from php 5.2.4.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-23 12:06 UTC]
Maybe, related to bug#44125
 [2008-03-24 22:26 UTC] lmeyer at ea dot com
Adding some results using php 5.2.3 and 5.2.5 :

WIN PATH : //NAS/nas/www/adodb5/
LNX PATH : \\\\NAS\\nas\\www\\adodb5\\
REALPATH : using realpath as suggested in bug#44125

                              WIN PATH  LNX PATH  WIN PATH   LNX PATH
                                                  REALPATH   REALPATH
PHP 5.2.3
FIRST INCLUDE ONCE (sec)      0.05	0.02      0.07       0.06
5sec. INCLUDE_ONCE (count)    250       338488    232        332800

PHP 5.2.5
FIRST INCLUDE ONCE (sec)      0.08      0.07      0.06       0.14
5sec. INCLUDE_ONCE (count)    215       228       310427     298643
 [2008-03-25 21:38 UTC] lmeyer at ea dot com
WIN PATH : //NAS/nas/www/adodb5/
LNX PATH : \\\\NAS\\nas\\www\\adodb5\\
REALPATH : using realpath as suggested in bug#44125

                              WIN PATH  LNX PATH  WIN PATH   LNX PATH
                                                  REALPATH   REALPATH
PHP 5.2 Dev Snap
FIRST INCLUDE ONCE (sec)      0.04	0.05      0.05       0.06
5sec. INCLUDE_ONCE (count)    295358    152       288045     282244

It's way better :), but still the problem remains for linux style path without realpath.
 [2008-04-02 19:05 UTC] mh at nextra dot ch
Same here. 

Including a file with full path spec (i.e. k:\www\\docs\inc.php) is the fastest here:
include_once count in 5 sec: 1356

Simply including the same file witout giving the full path spec is extremly slow:
include_once count in 5 sec: 170
 [2008-04-03 10:36 UTC] mh at nextra dot ch
It's still there in 5.3.0-dev.
 [2008-07-21 12:10 UTC]
Switch to not OS specific.

Dmitry, can you take a look?
 [2008-07-29 09:46 UTC]
I don't see any performance difference with PHP_5_2 and PHP_5_3 CVS versions. I also looked into filesystem calls with sysinternals FileMon and didn't see any difference. Probably this issue is already fixed.

 [2008-08-06 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Dec 09 02:05:54 2022 UTC