Re: Re: Ternary operator performance improvements
| From: | Nikita Popov | Date: | Wed, 09 Nov 2011 15:24:33 +0000 |
| Subject: | Re: Re: Ternary operator performance improvements | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-56194@lists.php.net to get a copy of this message | ||
Hi Miroslav!
Yes, the ternary patch fixes that problem too :)
Nikita
2011/11/9 Miroslav Kubelík <koubel@php.net>:
> On 10/14/2011 10:08 PM, Arnaud Le Blanc wrote:
>>
>> Hi,
>>
>> I've already posted this patch and it has since been reviewed and
>> improved.
>> I'm re-posting it for discussion before eventually commiting it.
>>
>> The ternary operator always copies its second or third operand, which is
>> very
>> slow compared to an if/else when the operand is an array for example: ....
>
> Same "copy always" behavior is made with string in ternary operator, and
> it can be
> also very annoying e.g:
>
> $content =
>
> file_get_contents('http://www.w3.org/TR/2011/WD-html-markup-20110525/spec..html');
> $test = $content !== false ? $content : '';
>
> Is this case also solved with your patch or huge strings are still problem
> with a ternary "copy always" functionality? Maybe it's more rare case then
> array.
>
> P.S: Sorry I don't test it directly with beta2, I have no place to test.
>
> M. Kubelik
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>