Re: include vs require

From: Date: Sun, 23 Feb 2003 23:56:05 +0000
Subject: Re: include vs require
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-13705@lists.php.net to get a copy of this message
Really? I find it hard to believe that the overhead is notceable (watch me bandy about such claims with no supporting evidence). The relative overhead of require_once should be close to zero. If it's noticeable at all, there is probably something wrong with the implementation - you should not be able to notice a single hash table lookup. The only reason I'm writing is that I think their is something.rather hyperbolic about the statement that require is 'faster' than require_once. Folklore on php performance tuning has a way of spreading like a social disease and I can foresee people going back to using include guards in their scripts (more expensive) to avoid the 'expense' of require_once. George On Sunday, February 23, 2003, at 06:37 PM, Rasmus Lerdorf wrote:
I didn't say the overhead was huge, just that it was there. ;) And it is measurable. -Rasmus On Sun, 23 Feb 2003, George Schlossnagle wrote:
Yeah... besides the hash table lookup, what exactly is the overhead? They both end up calling zend_fopen, which is the 'expense' of the vacuous call. Am I missing something significant? The overhead seems miniscule (it doesn't look like any additional system calls should be made, just some O(1) userspace stuff.) George On Sunday, February 23, 2003, at 05:19 PM, Tim Thorpe wrote:
I'm not trying to start another IT[X] flamewar here. I'm just pointing out that as PEAR grows, the probability of two simultaneously used libraries having a common dependency increases. A minor sacrifice to overhead seems a worthy cause if it will prevent (even small) headaches down the road. *don't flame me* :) -----Original Message----- From: Rasmus Lerdorf [mailto:rasmus@lerdorf.com] Sent: Sunday, February 23, 2003 3:51 PM To: Tim Thorpe Cc: pear-dev@lists.php.net Subject: RE: [PEAR-DEV] include vs require On Sun, 23 Feb 2003, Tim Thorpe wrote:
It was my understanding that require_once was made part of the PEAR coding standard to prevent files from being re-included when dependencies got hairy.
Correct. But if the dependencies are not hairy, then it is pure overhead. -Rasmus -- PEAR Development Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PEAR Development Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PEAR Development Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.pear.dev (#13705) next »