Re: Structure of PHP files

From: Date: Thu, 23 Jul 2009 14:41:25 +0000
Subject: Re: Structure of PHP files
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-295757@lists.php.net to get a copy of this message
Paul M Foster wrote:
On Thu, Jul 23, 2009 at 09:34:37AM -0400, Robert Cummings wrote: <snip>
Not that I disagree with your methodology at this time, but you could have just made that single big file, include all those little files and still had a single load statement in each of your consumer source files. With compile caches the burden of loading all that code at startup is rather negligible :)
I've heard this before, and I don't understand why people say this. If you have a 150k file you load before displaying a page, you've still occupied the CPU with the task of loading a 150k file. What happens to it afterward (compiling, compressing, caching, whatever) is another issue. You've still loaded 150k of code. The question is whether you actually need to load 150k of code from the start. If not, why waste the resources?
150k is peanuts and having it already in memory means it doesn't have to be loaded later. With a compile cache it's quite likely that over time you'll have the 150k loaded into memory anyways. It's just going to take longer for it to be loaded since the compile cache has to "encounter" it first. Once "encountered" it's still occupying the same memory. Additionally, the operating system does an excellent job of swapping memory not being accessed regularly (if it needs memory). Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP

« previous php.general (#295757) next »