From:             php at pk dot freesurf dot fr
Operating system: linux
PHP version:      5.2.8
PHP Bug Type:     Performance problem
Bug description:  include of same file is re-access and re-compiled each time 
within same script

Description:
------------
include "foo.php" within a loop is re-accessed & re-compile before
execution each time...

php already knows that the file has been included (include_once generates
an error), but does not remember the code within...

for source code clarity, has there is no macro-processor like in C, it is
very usefull to use the include statement...

a function call is not appropriate in every case, as local variable scope
can be a problem...
if there are 20 or more variable to be accessed, code will be not clear if
they are part of function arguments,
neither the code will be clear if all variables are declared global.

so it is really an issue for me...

Reproduce code:
---------------
<?
for ($i=0;$i<10000;++$i)
{
include "foo.php";
}
?>

foo.php : hundreds of code lines

when content of foo.php is pasted inside the loop, execution time
dramasticaly shorter..


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

Reply via email to