Re: Comments about PHPTAL package proposal?

From: Date: Mon, 20 Apr 2009 11:43:18 +0000
Subject: Re: Comments about PHPTAL package proposal?
References: 1 2 3 4 5 6 7 8  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-51766@lists.php.net to get a copy of this message
On 20-04-2009 at 06:08:03 Greg Beaver <greg@chiaraquartet.net> wrote:
...assuming the user has the Config package installed *and* is running on windows (all reasonable OSes are case-sensitive)
This was just one example of entire class of problems that such modification might cause, even on case-sensitive filesystems. I mentioned Config.php specifically, because I have ran into this myself on an unreasonable Mac OS X. However restore_include_path() in your later example looks like a good idea, and I'll go for that.
Even if CONSTANT == '/full/path/'? I think that (assuming no opcode cache) evaluation of string should still be much faster than extra disk access involved in relative paths.
you would be wrong - the above list is not conjecture, it is based on benchmarking 60 second runs of actual code through apache using siege as a benchmark tool.
OK, I've made benchmarks and got such result too. The result is counter-intuitive to me. Do you know why, without opcode cache, such small syntax difference has bigger negative impact than resolution of relative path?
Feel free to ignore my advice, but it is based upon actual benchmarking, not supposition, and your conclusion is refuted by the source code of APC itself.
I'm surprised that such optimisation holds against randomized include_path, and I don't see where my test/conclusions are wrong. I haven't studied APC's source, so I'll take your word. I've got one more related issue: Is it OK to include files within methods (conditionally)? 99% of the time PHPTAL runs compiled, cached copies of templates, and only requires small fraction of classes to run. By including only necessary minimum, I get 3-fold performance increase without opcode cache, and 2-fold with opcode cache (on simple benchmark that runs PHPTAL with empty template). Currently I have: class PHPTAL { … function parse() { require_once 'PHPTAL/Dom/DocumentBuilder.php'; … } This isn't pretty and probably APC-unfriendly as well. Is there a better solution? -- regards, Kornel

« previous php.pear.dev (#51766) next »