Re: APC optimization in CLI
| From: | Robert Cummings | Date: | Tue, 11 Aug 2009 10:52:35 +0000 |
| Subject: | Re: APC optimization in CLI | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-296619@lists.php.net to get a copy of this message | ||
Daevid Vincent wrote:
No, it's a small portion for most CLI scripts.From: Robert Cummings [mailto:robert@interjinn.com] However, accelerators don't make scripts faster per se. They merely cut out the script reading and parsing time.Which is a HUGE portion of time since PHP is a two-pass step. One that reads and compiles to opcodes (with syntax checking) and another which actually executes it.
No. It is not.So, while you may experience 10% gain within the first second of your script running, the use of an accelerator should have no bearing down the road except for the initial dynamic load of other scripts at runtime.This is sort of misleading.
You will experience faster page loads if it's a web php file, and if APC does allow you to run cached scripts via CLI, then these scripts will start execution immediately too.I've already mentioned it's efficacy in a web environment. I am explaining the cases where you won't get much value... namely CLI scripts.
Maybe you mean "PHP was not meant to be used for daemons" because I SURE AS HELL designed some of my scripts to be daemons and run for a long time... some run for months uninterrupted (usually need to reboot for OS updates once in a while). As for the former comment... that's a matter of opinion.Long running scripts will see almost no benefit from an accelerator.PHP scripts are (like it or not) NOT designed to be daemons and run for long
periods of time. The GC is no optimized for such things. It's quite inneficient from what I've read. The whole purpose of a PHP _page_ is to get in and get out. Hit it and quit it. Therefore memory efficiency is not as important as speed and ease of use.The GC works fine if you avoid circular references.
I would argue otherwise when the CLI is being used.This is the general reason why CLI acceleration isn't very useful. Thatsaidthough, one could certainly glean an advantage if they had a cron job or other daemon that was loading a script often.As is probably often the case, moreso than a "long running script".
I think a code optimizer is what would be desired if you're trying to make a faster script. However in this day and age, I suspect that the 2nd phase of the compiler already does all the optimizing it can before creating the byte code.You would be wrong... very few accelerators have bundled optimizers. Some may do a small amount of optimization, but not a lot. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP