Re: RETURN micro optimization
| From: | Pierre Joye | Date: | Tue, 05 Apr 2016 08:47:40 +0000 |
| Subject: | Re: RETURN micro optimization | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-92088@lists.php.net to get a copy of this message | ||
On Tue, Apr 5, 2016 at 2:59 PM, Dmitry Stogov <dmitry@zend.com> wrote:
> Hi,
>
>
> I propose a micro optimization for RETURN statement.
>
> Currently "return $x" increments reference counter of $x, then in zend_leave_helper()
> we perform zval_ptr_dtor() on the same $x.
>
> The patch sets the original value of $x to null in first place, so zval_ptr_dtor() is not going
> to be called.
>
>
>
> https://gist.github.com/dstogov/36f68b206242a39691ac539c2fc85d40
>
>
> the performance impact is invisible (0.1% less instruction retired on Wordpress).
>
>
> It breaks sapi/phpdbg/tests/breakpoints_005.phpt, but this is probably not a big deal.
>
> BTW: this change may affect debuggers in some other way.
I suppose it is for 7.1 anyway, right? so debugger will have to be
ported but it would be nice to know exactly how this change will
affect them to make sure that users can migrate to 7.1 smoothly and
still use their tools.
Cheers,
--
Pierre
@pierrejoye | http://www.libgd.org