Re: include vs require
| From: | Rasmus Lerdorf | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | Re: include vs require | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-13709@lists.php.net to get a copy of this message | ||
On Mon, 24 Feb 2003, Pierre-Alain Joye wrote:
> On Sun, 23 Feb 2003 15:59:02 -0800 (Pacific Standard Time)
> Rasmus Lerdorf <rasmus@lerdorf.com> wrote:
>
> > I haven't analyzed it in detail, but switching it in a Yahoo! app gave
> > me another couple of requests per second. I'll add it to my strace
> > stuff and have a closer look sometime in the next couple of days.
> > Perhaps someone did sneak something nasty in there. Our syscall bloat
> > has been really bad lately.
>
> If possible, keep us informed, it may be very interesting to get real
> exemples of hi-load site using the different include methods. (to close
> the debat for one day or two ;-) ).
I checked the code, and to verify, did the strace test as well. No
syscall differences between the two. But, it also wasn't a much of a
difference I saw. You gain way more by eliminating an include by
combining two files than by going from include_once to include.
Especially in the amazingly broken 4.3 code right now. The double
realpath() calls and the triple fstat() calls are deadly. Well, we only
get a double realpath() on the primary script, but each included file gets
a single realpath() which turns into a stat() for each directory level.
The really performance-paranoid should put all their includes in the /
directory (half-joking ;), but the triple fstat() calls happen on every
included file so including files in 4.3 is much more expensive than it
needs to be right now.
-Rasmus