Re: Bug #47643 - array_diff slowdown
| From: | Lonny K | Date: | Mon, 01 Nov 2010 15:54:45 +0000 |
| Subject: | Re: Bug #47643 - array_diff slowdown | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-50060@lists.php.net to get a copy of this message | ||
Can we get some opinions on this. I'm willing to make the changes, but I
want to get some sort of consensus on this.
Basically I believe the problem is that patch 42838 should be reverted and
the documentation should be updated. Someone on IRC had disagreed with me
so I want more opinions before I do anything.
On Fri, Aug 27, 2010 at 4:01 AM, Lonny K <lonnyk@gmail.com> wrote:
> I wanted to discuss this bug to try to get it resolved. I briefly
> discussed this over ICQ and had differing opinions then the person I was
> talking to, so naturally I wanted a bigger audience.
>
> Quick summary of what's going on:
> * 47643 is about array_diff being slow.
> * This was caused by the patch for 42838
> * The problem with 42838 is basically that 0 != '0'
> * Here is the diff: http://www.lonnylot.com/42838.diff
> The lines that causes the slowdown are:
>
> - while (*ptrs[i] && (0 < (c = diff_data_compare_func(ptrs[0], ptrs[i]
> TSRMLS_CC)))) {
> - ptrs[i]++;
> + while (*ptr && (0 < (c = diff_data_compare_func(ptrs[0], ptr TSRMLS_CC)))) {
> + ptr++;
> }
>
>
> I feel the fix should be reverting 42838 because I feel 42838 wasn't a code
> issue, but a documentation issue. It is noted in some places that comparing
> a string to an integer results in the string being changed to 0. That is the
> issue in 42838 and b/c this is excepted in other places it should be
> excepted here. The documentation should be updated to say to typecast your
> comparison to (string) if it is going to be important to your code.
>