Re: APC optimization in CLI

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

 



Daevid Vincent wrote:
From: Robert Cummings [mailto:robert@xxxxxxxxxxxxx] 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's a small portion for most CLI scripts.

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.

No. It is not.

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.

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

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.

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.

This is the general reason why CLI acceleration isn't very useful. That
said
though, 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 would argue otherwise when the CLI is being used.

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

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