Hi John:

On Fri, Nov 30, 2007 at 12:13:14AM -0500, John Campbell wrote:
> 
> That is news to me.  Why is include_once a performance drag?

As Rob mentioned, include_once makes the PHP perform stat calls on the 
file system to make sure the file you want to include has not been done 
already.  Rasmus went over this at the NYPHP conference last year in a 
talk entield "Getting Rich with PHP."

http://talks.php.net/show/nyphp06/8

PHP may have been optimized since then, but regardless of how optimized 
it has gotten, the file system checks cost more than not having to do 
them.


> What is
> the better programming logic, that doesn't just duplicate the
> behavior?

Take the time to strucutre the logic to only include a given file one 
time.  For example, including critical files up front.  While clean logic 
can't eliminate all uses of include_once, it can get rid of most.

--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to