Re: [PHP-DEV] Improvements to for-each implementation

2015-01-29 Thread Dmitry Stogov
Hi, I've solved most of the reported problems and started working on RFC. Nikta, please take a look into: https://wiki.php.net/rfc/php7_foreach https://github.com/php/php-src/pull/1034 and especially commit 15a23b1 Only iteration by value over plain objects is not completely consistent now. Howe

Re: [PHP-DEV] Improvements to for-each implementation

2015-01-27 Thread Dmitry Stogov
I've created a branch and pull request for easier collaboration and tracking. https://github.com/php/php-src/pull/1034 It's the same diff I published yesterday. Nothing changed or added yet. Thanks. Dmitry. On Wed, Jan 28, 2015 at 1:36 AM, Nikita Popov wrote: > On Tue, Jan 27, 2015 at 5:55 PM

Re: [PHP-DEV] Improvements to for-each implementation

2015-01-27 Thread Xinchen Hui
al pointer all together, but we would just >> >> use >> >> it for the less common by-reference case as well as for the legacy >> >> reset/next functions, of course. This would still improve most for-each >> >> traversals. At least we then wouldn&

Re: [PHP-DEV] Improvements to for-each implementation

2015-01-27 Thread Dmitry Stogov
traversals. At least we then wouldn't have to find a replacement > solution > >> for rest/prev/next/end. Moreover we can then move the internal position > >> pointer out of the hashtable structure into zend_array because it is > only > >> used for userla

Re: [PHP-DEV] Improvements to for-each implementation

2015-01-27 Thread Xinchen Hui
into zend_array because it is only >>> used for userland arrays, not other hash tables (such as object properties >>> or internal structures that build upon the hashtable struct). >>> >>> Thanks, >>> >>> Ben >>> >>> ==

Re: [PHP-DEV] Improvements to for-each implementation

2015-01-27 Thread Xinchen Hui
on >> pointer out of the hashtable structure into zend_array because it is only >> used for userland arrays, not other hash tables (such as object properties >> or internal structures that build upon the hashtable struct). >> >> Thanks, >> >> Ben &g

Re: [PHP-DEV] Improvements to for-each implementation

2015-01-27 Thread Dmitry Stogov
On Jan 28, 2015 2:36 AM, "Nikita Popov" wrote: > > On Tue, Jan 27, 2015 at 5:55 PM, Dmitry Stogov wrote: >> >> Hi, >> >> I'm working on a PoC, implementing the proposed behavior - https://gist.github.com/dstogov/a311e8b0b2cabee4dab4 >> >> Only few PHPT tests had to be changed to confirm new behav

Re: [PHP-DEV] Improvements to for-each implementation

2015-01-27 Thread Nikita Popov
On Tue, Jan 27, 2015 at 5:55 PM, Dmitry Stogov wrote: > Hi, > > I'm working on a PoC, implementing the proposed behavior - > https://gist.github.com/dstogov/a311e8b0b2cabee4dab4 > > Only few PHPT tests had to be changed to confirm new behavior and actually > they started to behave as HHVM. > 2 te

Re: [PHP-DEV] Improvements to for-each implementation

2015-01-27 Thread Yasuo Ohgaki
Hi Dmitry, On Wed, Jan 28, 2015 at 1:55 AM, Dmitry Stogov wrote: > I'm working on a PoC, implementing the proposed behavior - > https://gist.github.com/dstogov/a311e8b0b2cabee4dab4 > > Only few PHPT tests had to be changed to confirm new behavior and actually > they started to behave as HHVM. >

Re: [PHP-DEV] Improvements to for-each implementation

2015-01-27 Thread Rasmus Lerdorf
On 01/27/2015 08:55 AM, Dmitry Stogov wrote: > The patch makes ~1% improvement on Wordpress-3.6 (saving duplication and > destruction of 200 arrays on each request) Awesome! signature.asc Description: OpenPGP digital signature

Re: [PHP-DEV] Improvements to for-each implementation

2015-01-27 Thread Dmitry Stogov
is only > used for userland arrays, not other hash tables (such as object properties > or internal structures that build upon the hashtable struct). > > Thanks, > > Ben > > == Original == > From: Nikita Popov > To: Benjamin Coutu > Date: Thu, 22

Re: [PHP-DEV] Improvements to for-each implementation

2015-01-22 Thread Benjamin Coutu
P-DEV] Improvements to for-each implementation Doing this was the idea I had in mind as well, i.e. change the semantics of foreach to say that it will always work on a copy for by-value iteration (which ironically avoids having to actually copy it). Note that this will differ from the current behavior

Re: [PHP-DEV] Improvements to for-each implementation

2015-01-22 Thread Nikita Popov
On Thu, Jan 22, 2015 at 9:33 AM, Benjamin Coutu wrote: > Hi, > > this post is a fork of the "[PHP-DEV] Fixing strange foreach behavior" > thread. It proposes a more efficient for-each mechanism (that does NOT > change the conceptual behaviour). > > Currently on for-each the engine will have to co

[PHP-DEV] Improvements to for-each implementation

2015-01-22 Thread Benjamin Coutu
Hi, this post is a fork of the "[PHP-DEV] Fixing strange foreach behavior" thread. It proposes a more efficient for-each mechanism (that does NOT change the conceptual behaviour). Currently on for-each the engine will have to copy the array if that array is visible anywhere else in the program