#47643 [Com]: array_diff() takes over 3000 times longer than php 5.2.4
| From: | maarten at talkin dot nl | Date: | Wed, 17 Feb 2010 20:53:54 +0000 |
| Subject: | #47643 [Com]: array_diff() takes over 3000 times longer than php 5.2.4 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-147800@lists.php.net to get a copy of this message | ||
ID: 47643
Comment by: maarten at talkin dot nl
Reported By: viper7 at viper-7 dot com
Status: Assigned
Bug Type: Performance problem
Operating System: *
PHP Version: 5.*, 6CVS (2009-04-13)
Assigned To: felipe
New Comment:
Why dont you only reset ptr if (behavior & DIFF_ASSOC) ?
Previous Comments:
------------------------------------------------------------------------
[2010-01-17 12:09:15] emiel dot bruijntjes at copernica dot com
This bug is now open for 10 months. Are you still working on this?
------------------------------------------------------------------------
[2009-07-09 20:38:20] jani@php.net
As Dmitry's noted, this is side-effect your fix caused.
------------------------------------------------------------------------
[2009-07-01 15:32:01] dmitry@php.net
The problems occurs because of "bad" patch for bug #42838.
The diff algorithm sorts arrays using qsort and then assumes that they
are sorted correctly. But in case of user compaison function it can't be
guaranteed. Thus in ext/standard/tests/array/bug42838.phpt
key_compare_func() can't sort array correctly because expressions (0 <
'a') and (0 > 'a') both false ('a' is interpreted as a number 0).
It should be fixed in some way
------------------------------------------------------------------------
[2009-06-30 15:22:24] derick@php.net
Dmitry, could you have a look? I have no idea why this occurs.
------------------------------------------------------------------------
[2009-06-30 15:19:43] viper7 at viper-7 dot com
I've tracked down the change that broke things, this is it. but the
exact reason is beyond me heh. Hopefully this helps.
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.51&r2=1.308.2.21.2.52&pathrev=PHP_5_2
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/47643
--
Edit this bug report at http://bugs.php.net/?id=47643&edit=1