On Tue, Aug 27, 2013 at 11:40 AM, Nikita Popov <nikita....@gmail.com> wrote:

> On Sat, Aug 3, 2013 at 8:16 PM, Nikita Popov <nikita....@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

Reply via email to