Re: Improved performance of array_maerge() and func_get_args()
| From: | Dmitry Stogov | Date: | Wed, 23 Oct 2013 14:00:20 +0000 |
| Subject: | Re: Improved performance of array_maerge() and func_get_args() | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-69806@lists.php.net to get a copy of this message | ||
makes sense. thanks :)
Dmitry.
On Wed, Oct 23, 2013 at 5:52 PM, Nikita Popov <nikita.ppv@gmail.com> wrote:
> On Wed, Oct 23, 2013 at 2:36 PM, Dmitry Stogov <dmitry@zend.com> wrote:
>
>> Hi,
>>
>> I'm proposing two simple patches that eliminate a lot of useless zval
>> copying.
>> For example they remove only about 800 calls to zend_hash_copy() (25%) on
>> each request to wordpress-3.6.0 home page and make it 2-4% faster.
>>
>> It's not a questions about master branch, but I think it is also safe to
>> commit them into PHP-5.4 and PHP-5.5.
>>
>> Any objections?
>>
>> https://gist.github.com/dstogov/7117623
>>
>> https://gist.github.com/dstogov/7117649
>>
>> Thanks. Dmitry.
>>
>
> No objection, just quick note on func_get_args patch: You can use
> SEPARATE_ARG_IF_REF there, so the code in the loop body is:
>
> zval *arg = *(p-(arg_count-i));
> SEPARATE_ARG_IF_REF(arg);
> zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &arg,
> sizeof(zval *), NULL);
>
> Nikita
>