Bug #47643 - array_diff slowdown

From: Date: Fri, 27 Aug 2010 08:01:46 +0000
Subject: Bug #47643 - array_diff slowdown
Groups: php.internals 
Request: Send a blank email to internals+get-49548@lists.php.net to get a copy of this message
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.

« previous php.internals (#49548) next »