[PHP-DEV] Of string constants, bytecode, and concatenation

2003-02-26 Thread David Brown
Hi everyone: This may well be a stupid question, but I've spend enough time staring blankly at zend_compile.c/zend_execute.c that I figured it was time to ask. :) Say I have a section of code like this: ?php $s1 = 'foo' . 'bar' . 'baz'; $s2 = 'foobarbaz'; ? In the PHP bytecode (I hope I'm

Re: [PHP-DEV] Of string constants, bytecode, and concatenation

2003-02-26 Thread Derick Rethans
On Wed, 26 Feb 2003, David Brown wrote: This may well be a stupid question, but I've spend enough time staring blankly at zend_compile.c/zend_execute.c that I figured it was time to ask. :) Say I have a section of code like this: ?php $s1 = 'foo' . 'bar' . 'baz'; $s2 = 'foobarbaz';

Re: [PHP-DEV] Of string constants, bytecode, and concatenation

2003-02-26 Thread George Schlossnagle
It's the job of an optimizer, not of a compiler. And because PHP doesn't have an internal optimizer, this is not optimized out. You can either check the ZendOptimiser (I can't show you the opcodes that that generates) or PEAR::Optimizer, which is in Pecl (which might not do this optimization yet

Re: [PHP-DEV] Of string constants, bytecode, and concatenation

2003-02-26 Thread David Brown
On Wed, Feb 26, 2003 at 05:36:54PM +0100, Derick Rethans wrote: | No, the engine doesn't do this at compile time. This first one produces: | | number of ops: 5 | line # op fetch ext operands | ---

Re: [PHP-DEV] Of string constants, bytecode, and concatenation

2003-02-26 Thread Daniel Cowgill
On Wed, 26 Feb 2003, David Brown wrote: Okay. Makes complete sense. I was thinking more along the lines of wouldn't it be nice if...?. I hadn't quite made it to where would that belong?. :) I'll check out the optimizers. I noticed that the new CVS version of APC seems to have a

Re: [PHP-DEV] Of string constants, bytecode, and concatenation

2003-02-26 Thread Derick Rethans
On Wed, 26 Feb 2003, David Brown wrote: Is that output a ZEND_DEBUG thing, or is that an external tool? It's an external tool: VLD from http://www.derickrethans.nl/vld.php Derick -- Stop mad cowboy disease!