Re: Re: Validation class comments
| From: | Manuel Lemos | Date: | Thu, 30 May 2002 16:14:20 +0000 |
| Subject: | Re: Re: Validation class comments | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-6665@lists.php.net to get a copy of this message | ||
Hello,
On 05/30/2002 03:38 AM, Stig S. Bakken wrote:
Of course, why else it would be called Accelerator! :-) Anyway, maybe you do not know that most of acceleration comes form the fact that the when the cached code is run it does not have to be compiled again. As a matter of fact, if you would have to load compiled code from disk it would still provide great speedup. That is basically how APC cache work in MMAP mode. The code is compiled and stored in memory mapped files. Those files contain PHP compiled code that is loaded on demand. Actually, as a side comment for people that are not aware and may be interested, APC compiled files in MMAP mode may be distributed and run without the original scripts, constituting a working alternatived to the expensive Zend Encoder. Back to my original point, keep in mind that in many systems the amount of shared memory that each process can use is limited and only system administrators can lift it. So, don't forget to not abuse from shared memory as it may prevent applications that rely on it to work on systems with low shared memory limits.Let it be noted that the code is kept in _shared_ memory, and IMHO the tradeoff is well worth it. An Apache process that spends longer time processing a PHP-driven request will consume memory for a _longer period of time_ (using an OS that will actually return free()'d memory to the especially during peak times. YMMV of course, but my experience with ZA is that it always increases the performance of your site.Wouldn't using PHP-Accelerator get around this problem?It's a trade-off. You trade loading/compiling overhead for memory. This means that the compiled cached code will be using memory even if the current script does not need them. In the end detaching validation code from a main class will not make you gain anything because the code will be occupying memory whether you use it or not.
That being said, I'm not a big fan of having lots of "trivial" classes wrapping lots of very simple code into a framework of overhead.Precisely my point. -- Regards, Manuel Lemos