Re: [PHP-DEV] Generating more efficient code for while-loop

2015-01-16 Thread Dmitry Stogov
Hi Benjamin, Thanks for idea. With PHP7 AST compiler, it's quite easy to implement this (it took us 15 minutes to try :) However, it doesn't make big improvement on our benchmarks. We will take a look into possibilities to apply your idea to other patterns (e.g. for and foreach loops). Anyway,

Re: [PHP-DEV] Generating more efficient code for while-loop

2015-01-16 Thread Xinchen Hui
Hey: On Sat, Jan 17, 2015 at 12:12 AM, Dmitry Stogov dmi...@zend.com wrote: Hi Benjamin, Thanks for idea. With PHP7 AST compiler, it's quite easy to implement this (it took us 15 minutes to try :) yeah... by handy :) However, it doesn't make big improvement on our benchmarks. in reallife

Re: [PHP-DEV] Generating more efficient code for while-loop

2015-01-16 Thread Dmitry Stogov
See the patch for while and for loops https://gist.github.com/dstogov/9cc5767a14f3b88e1275 All tests passed. The patch leads to 2% improvement in number of CPU instructions retired on bench.php. Unfortunately, It doesn't make any visible speed difference. Anyway, I'm going to commit it on

Re: [PHP-DEV] Generating more efficient code for while-loop

2015-01-16 Thread Nikita Popov
On Fri, Jan 16, 2015 at 6:09 PM, Dmitry Stogov dmi...@zend.com wrote: See the patch for while and for loops https://gist.github.com/dstogov/9cc5767a14f3b88e1275 All tests passed. The patch leads to 2% improvement in number of CPU instructions retired on bench.php. Unfortunately, It

Re: [PHP-DEV] Generating more efficient code for while-loop

2015-01-16 Thread Benjamin Coutu
...@zend.com To: Benjamin Coutu ben.co...@zeyos.com Date: Fri, 16 Jan 2015 17:12:34 +0100 Subject: Re: [PHP-DEV] Generating more efficient code for while-loop Hi Benjamin, Thanks for idea. With PHP7 AST compiler, it's quite easy to implement this (it took us 15 minutes to try :) However, it doesn't

Re: [PHP-DEV] Generating more efficient code for while-loop

2015-01-16 Thread Xinchen Hui
Subject: Re: [PHP-DEV] Generating more efficient code for while-loop Hi Benjamin, Thanks for idea. With PHP7 AST compiler, it's quite easy to implement this (it took us 15 minutes to try :) However, it doesn't make big improvement on our benchmarks. We will take a look into possibilities

[PHP-DEV] Generating more efficient code for while-loop

2015-01-15 Thread Benjamin Coutu
Hello, Please consider the following PHP code: while ( CONDITION ) { STATEMENT } It currently compiles to something like this for the Zend Engine: 0: CONDITION 1: JMPZ - 4 2: STATEMENT 3: JMP - 0 4: ... This can easily be rewritten in an equivalent but much more efficient form: 0: JMP - 2