Re: Structured Code vs. Performance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2007-11-29 at 08:56 +0100, news_yodpeirs@xxxxxxxxxxxx wrote:
> I got different portions of code only used for certain purposes (who don't 
> ;-)?). But what, in your opinion (better: in your experience) would be the 
> best regarding script-performance: Putting each code-portion in a separate 
> file and include it if required, putting it in a constant-dependent 
> if-structure (if (defined('FOO') && FOO) {class foo{}; function foo(); ...}) 
> or simply let it be parsed every time?
> 
> My first choice is using separate files, but if a file e.g. only contains 20 
> lines, I fear it would take much longer to include the file against simply 
> parsing these lines in the existing file. And as parsing is done really 
> fast, there might be no real performance-loss in case of not using the 
> mentioned code. With the constant-dependent if-structure I don't know if 
> there are any performance-benefits if FOO isn't defined or defined as FALSE.
> 
> Looks for me a bit like a philosophical question, but maybe you have 
> something to say about it nevertheless. A good thing for me would be 
> something like: up to 125 lines of code you get an adequate performance with 
> simply parsing it every time, with more than 125 lines you would get a 
> better performance with using separate files - just kidding, surely the 
> number of lines in this case is 42 ;-).

Install a compile cache like eaccelerator or APC. keep your code
organized, that usually means use multiple files for the code.

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux