Re: Making it easier to leverage APC

From: Date: Sat, 02 Dec 2006 16:41:57 +0000
Subject: Re: Making it easier to leverage APC
References: 1 2 3  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-4378@lists.php.net to get a copy of this message
Edin, This is one instance where an optimizer (such as the one I am working on) comes in. It can optimize out the entire define ("SITE_ROOT" . dirname(__FILE__)); expression making it a known compile time defined constant, thus converting include SITE_ROOT . "/lib/classes/MyDBClass.php"; to include "/path/to//lib/classes/MyDBClass.php"; with which APC has no issues. Ilia On 2-Dec-06, at 8:42 AM, Edin Kadribasic wrote:
Hello, From what I understand conditional includes are not the only probem. Having includes use variables/constants has the same net effect: define ("SITE_ROOT" . dirname(__FILE__)); include SITE_ROOT . "/lib/classes/MyDBClass.php"; This limitation of bytecode cache (if it indeed exists) is limiting when it comes to the way how PHP applications can be deployed. Edin Marcus Boerger wrote:
Hello Lukas, quite some time abgo i already said that the solution is to disallow class definition outsid eof main scope. As this would create BC issue what we actually should do is flag those classes who got defined in main and suppress them when a script runs and brings a new non main block defined class of the same name - but only during that request - and actually not caching the new one. I am also working in the direction of integrating pecl/phar with APC (though I have more pressuringthings to do in PHP). The idea is that the phars could contain the compiled code already and provide the implementation in a very fast way to PHP. In the end those could be loaded APC or Phar at PHP startup already and never be loaded again. best regards marcus Saturday, December 2, 2006, 12:28:01 PM, you wrote:
Hi,
I recently blogged a quote from Rasmus on how autload and front controllers essentially by pass most of what APC can do to speed up PHP [1].
I am wondering if there isnt something we can do to make it possible to still leverage APC. I guess one issue that APC has to deal with is the fact that conditional includes essentially mean you could load different implementations of the same code. This is an edge case that is obviously legit, but I do not think it is very common at all.
Furthermore a lot of PHP libraries are essentially like PHP extensions to the end user and I think this is why they are turning to autoload. They just want the functionality to be there. So maybe we should make it possible to load a set of classes into every instance automatically.
Either way we should really put out a guide on how to write code that makes optimal use of byte code caches. I am not really a performance expert but I am willing to take care of editing this document for final consumption if people help me with making sure the content base is sound.
regards, Lukas
[1] http://pooteeweet.org/blog/538
Best regards, Marcus
--PECL development discussion Mailing List (http://pecl.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Ilia Alshanetsky

« previous php.pecl.dev (#4378) next »