Re: Always set return_value_ptr?
| From: | Nikita Popov | Date: | Sat, 31 Aug 2013 13:13:00 +0000 |
| Subject: | Re: Always set return_value_ptr? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-68778@lists.php.net to get a copy of this message | ||
On Tue, Aug 27, 2013 at 11:40 AM, Nikita Popov <nikita.ppv@gmail.com> wrote:
> On Sat, Aug 3, 2013 at 8:16 PM, Nikita Popov <nikita.ppv@gmail.com> wrote:
>
>> Hi internals!
>>
>> Is there any particular reason why we only pass return_value_ptr to
>> internal functions if they have the ACC_RETURN_REFERENCE flag set?
>>
>> Why can't we always provide the retval ptr, even for functions that don't
>> return by reference? This would allow returning zvals without having to
>> copy them first (what RETVAL_ZVAL does).
>>
>> Motivation for this is the following SO question:
>> http://stackoverflow.com/q/17844379/385378
>>
>
> Patch for this change can be found here:
> https://github.com/php/php-src/pull/420
>
> The patch also adds new macros to allow easy use of this feature called
> RETVAL_ZVAL_FAST/RETURN_ZVAL_FAST (anyone got a better name?)
>
> If no one objects I'll merge this sometime soon.
>
Changes merged. Small benchmark to verify that this indeed avoids the copy:
https://gist.github.com/nikic/6398090 :)
Nikita