Re: Optimizing php_html_entities()
| From: | Xinchen Hui | Date: | Wed, 24 Jun 2015 02:42:22 +0000 |
| Subject: | Re: Optimizing php_html_entities() | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-86829@lists.php.net to get a copy of this message | ||
Hey:
On Wed, Jun 24, 2015 at 10:35 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
> Hi Xinchen,
>
> On Wed, Jun 24, 2015 at 11:31 AM, Xinchen Hui <laruence@php.net> wrote:
>>
>>
>>
>>
>> On Wed, Jun 24, 2015 at 8:32 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
>> > Hi Xinchen,
>> >
>> > On Tue, Jun 23, 2015 at 11:33 PM, Xinchen Hui <laruence@php.net> wrote:
>> >>
>> >> But passing an non-string to htmlspecialchars are not common used
>> >> cases..
>> >>
>> >> "optimize" not common used cases... will bring nothing to us..
>> >
>> >
>> > The reason why I looked into this in the first place is one of my friend
>> > complained about slow htmlspecialchars for relatively large table data.
>> >
>> > He said more than half of execution time is took by htmlspecialchars
>> > because
>> >
>> > - it escapes numeric values as string
>> > - it does not accept array value for to be escaped values
>> >
>> > 1st is covered by this patch.
>> > 2nd issue is covered by this FR.
>> > https://bugs.php.net/bug.php?id=69908
>> >
>> > So it brings something for us :)
>> Then what about strlen(number)? are you also going to change its ZPP
>> to accept zval instead of string?
>
>
> No. Only some kind of conversion functions are the subject.
> e.g. mb_convert_encoding(), mb_convert_kana(), etc.
What I meant is that it's rarely usage(like strlen(number)). we should
not care about them too much and break arg info.
and for the "age" usage you replied in github, I think the author of
such codes should be aware, if it's only number, then instead of
htmlespcicalchars($age), he should use echo $age directly... which is
more faster.
so, I am -1 or this "optimization".
thanks
>
> Regards,
>
> --
> Yasuo Ohgaki
> yohgaki@ohgaki.net
--
Xinchen Hui
@Laruence
http://www.laruence.com/