Re: PHP programming strategy

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

 



On Sun, 02 Aug 2009 04:25:40 +0300, Clancy <clancy_1@xxxxxxxxxxxx> wrote:

Is anyone here interested in discussing programming strategy, or or know of a discussion
group which is interested in the subject?

The sorts of questions I am interested in are:

1. I have a highly variable program which always shows the same page, but which includes different modules to give different results. The various modules call on different functions. Is it better to minimise memory by including only the functions actually required, but increase the number of files included, or to bundle all the functions into one file, thereby reducing the number of files included but increasing the size in memory?

2. As PHP is an interpreted program comments certainly increase the memory requirements, and presumably they slow down the operation of the program. Would stripping out the comments before uploading the production version give any visible improvement in
performance?

I think, first question you should answer following questions:
1. How large is your workload ?
2. How it is easier to develop this program?
3. can you logically split functions to different modules ?
4. Did you used other methods of optimizations ?

This questions is important because:
1. if you don't have huge workload - this kind of optimization won't help you at all. just will take time needed for actual divelopment.

2. PHP Compiler are already fast enough. So if you don't have very high-load website, then it is more important how fast you write program, rather than how many files do you have.

3. If you can logically split them - then it is good to split them, because it will easier to develop them.
Mostly, I personally try to separate functions to a modules:
I have 2-3 files per action: skin file, and action file. Sometimes: datatype file (for functions related to information type, like "Person") Also I have like 10 library files: they have all functions related to this library: "skins" , "person related", etc.

This is optimanl, because I can easily find whatever I need when developing.

4. If you have huge load, then it is much more efficient (and easier) to use other methods. For Example: install APC (http://fi2.php.net/apc ) It will cache all requests to your files and this will have huge impact on your performance. Much more than you can achieve by stripping comments on moving functions around. (and it is also very easy to install)

Also Memcached & Mysql optimization may help a lot.






--

--
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