Alain Williams wrote: > On Wed, Jan 13, 2010 at 10:25:01AM -0500, Graham Kelly wrote: >> Hi, >> >> Optimizations such as 5+7 into 13 really don't get you much. ZEND_ADD (and >> other basic opcodes) are not in any way a slow point in a program. And >> unfortunately to be able to optimize these you would probably need to put in >> an extra pass in the compiler which would probably just slow things down >> (unless you have a LOT of these types of additions). >> >> As for the foo() example... This looks very simple however it is actually a >> very hard problem that would most likely take far more time and resources to >> solve in the compiler then it would to just leave it be. The problem here is >> that you need to understand everywhere that $a is assigned a value and its >> value is used. The problem becomes very hard in other functions that have >> loops and other types of control structures. It really just ends up >> becomming a fairly complex mess to solve. >> >> The same can be said about quite a few of the other optimizations you can >> think of. On the surface they seem simple (and a few of them actually are) >> but most of them are complex... largely do to some of the unique 'features' >> of PHP. >> >> In any case, optimization in PHP is not a lost cause. The first thing you >> should really do is be using an opcode cache such as APC. Other than that > > Unfortunately: APC does not work with PHP 5.3 -- I have a site where I would > love to use it but I cannot. I use APC to great effect elsewhere.
The svn version works ok with 5.3. Turn off gc though. You shouldn't be writing code that requires garbage collection anyway if you are looking for speed. -Rasmus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php