Re: [PHP-DEV] [PHP-CVS] com php-src: Faster sorting algo: UPGRADING Zend/Makefile.am Zend/tests/methods-on-non-objects-usort.phpt Zend/zend_API.c Zend/zend_hash.c Zend/zend_hash.h Zend/zend_ini.c Zend

2015-01-19 Thread Alexey Zakhlestin
On 19 Jan 2015, at 07:52, Rasmus Lerdorf ras...@lerdorf.com wrote: On 01/18/2015 02:08 PM, Rasmus Lerdorf wrote: We have to be really really careful with this oh, that code is wrong, so we can break it argument. This will break hundreds if not thousands of sites in a hard-to-debug way. It

Re: [PHP-DEV] [PHP-CVS] com php-src: Faster sorting algo: UPGRADING Zend/Makefile.am Zend/tests/methods-on-non-objects-usort.phpt Zend/zend_API.c Zend/zend_hash.c Zend/zend_hash.h Zend/zend_ini.c Zend

2015-01-18 Thread Rasmus Lerdorf
On 01/18/2015 09:00 PM, Andrea Faulds wrote: That would also mean a future sorting API could unify user sorts and non-user sorts: just make the default callback be cmp(). Usage would be like this: cmp(1, 2); // 1 cmp(1, 1); // 0 cmp(2, 1); // 1 Essentially, exactly like the spaceship

Re: [PHP-DEV] [PHP-CVS] com php-src: Faster sorting algo: UPGRADING Zend/Makefile.am Zend/tests/methods-on-non-objects-usort.phpt Zend/zend_API.c Zend/zend_hash.c Zend/zend_hash.h Zend/zend_ini.c Zend

2015-01-18 Thread Xinchen Hui
Hey: On Mon, Jan 19, 2015 at 12:52 PM, Rasmus Lerdorf ras...@lerdorf.com wrote: On 01/18/2015 02:08 PM, Rasmus Lerdorf wrote: We have to be really really careful with this oh, that code is wrong, so we can break it argument. This will break hundreds if not thousands of sites in a

Re: [PHP-DEV] [PHP-CVS] com php-src: Faster sorting algo: UPGRADING Zend/Makefile.am Zend/tests/methods-on-non-objects-usort.phpt Zend/zend_API.c Zend/zend_hash.c Zend/zend_hash.h Zend/zend_ini.c Zend

2015-01-18 Thread Rasmus Lerdorf
On 01/18/2015 02:08 PM, Rasmus Lerdorf wrote: We have to be really really careful with this oh, that code is wrong, so we can break it argument. This will break hundreds if not thousands of sites in a hard-to-debug way. It took me less than a minute of looking on Github to find a case that

Re: [PHP-DEV] [PHP-CVS] com php-src: Faster sorting algo: UPGRADING Zend/Makefile.am Zend/tests/methods-on-non-objects-usort.phpt Zend/zend_API.c Zend/zend_hash.c Zend/zend_hash.h Zend/zend_ini.c Zend

2015-01-18 Thread Xinchen Hui
Hey: Rasmus, Thanks for the reporting... I didn't think it is a real reasonable question at the very beginning Anyway, this should be fixed in : https://github.com/php/php-src/commit/020b51b46eceb1a8c2876aac263772ed55ba9a1a thanks On Mon, Jan 19, 2015 at 2:06 PM, Xinchen Hui

Re: [PHP-DEV] [PHP-CVS] com php-src: Faster sorting algo: UPGRADING Zend/Makefile.am Zend/tests/methods-on-non-objects-usort.phpt Zend/zend_API.c Zend/zend_hash.c Zend/zend_hash.h Zend/zend_ini.c Zend

2015-01-18 Thread Levi Morrison
On Sun, Jan 18, 2015 at 3:08 PM, Rasmus Lerdorf ras...@lerdorf.com wrote: On 01/18/2015 11:45 AM, Stanislav Malyshev wrote: Hi! Yes, like I said, I am aware that the comparison function is flaky but it is still code that has worked for 15 years so we have to be clear about the BC break. The

Re: [PHP-DEV] [PHP-CVS] com php-src: Faster sorting algo: UPGRADING Zend/Makefile.am Zend/tests/methods-on-non-objects-usort.phpt Zend/zend_API.c Zend/zend_hash.c Zend/zend_hash.h Zend/zend_ini.c Zend

2015-01-18 Thread Andrea Faulds
On 19 Jan 2015, at 05:03, Rasmus Lerdorf ras...@lerdorf.com wrote: On 01/18/2015 09:00 PM, Andrea Faulds wrote: That would also mean a future sorting API could unify user sorts and non-user sorts: just make the default callback be cmp(). Usage would be like this: cmp(1, 2); // 1

Re: [PHP-DEV] [PHP-CVS] com php-src: Faster sorting algo: UPGRADING Zend/Makefile.am Zend/tests/methods-on-non-objects-usort.phpt Zend/zend_API.c Zend/zend_hash.c Zend/zend_hash.h Zend/zend_ini.c Zend

2015-01-18 Thread Andrea Faulds
Hey Rasmus, On 19 Jan 2015, at 04:52, Rasmus Lerdorf ras...@lerdorf.com wrote: On 01/18/2015 02:08 PM, Rasmus Lerdorf wrote: We have to be really really careful with this oh, that code is wrong, so we can break it argument. This will break hundreds if not thousands of sites in a

Re: [PHP-DEV] [PHP-CVS] com php-src: Faster sorting algo: UPGRADING Zend/Makefile.am Zend/tests/methods-on-non-objects-usort.phpt Zend/zend_API.c Zend/zend_hash.c Zend/zend_hash.h Zend/zend_ini.c Zend

2015-01-18 Thread Andrea Faulds
On 19 Jan 2015, at 05:00, Andrea Faulds a...@ajf.me wrote: Related: since we have no Perl-like spaceship operator ($a = $b), writing comparison functions is unnecessarily complex in the common case, as you must produce -1, 0, 1 yourself. Could we expose a cmp() or compare() function

Re: [PHP-DEV] [PHP-CVS] com php-src: Faster sorting algo: UPGRADING Zend/Makefile.am Zend/tests/methods-on-non-objects-usort.phpt Zend/zend_API.c Zend/zend_hash.c Zend/zend_hash.h Zend/zend_ini.c Zend

2015-01-18 Thread Stanislav Malyshev
Hi! Yes, like I said, I am aware that the comparison function is flaky but it is still code that has worked for 15 years so we have to be clear about the BC break. The fact that it works up until the array Looking at that function, I'm not sure the fact it worked is not pure luck. It is not

Re: [PHP-DEV] [PHP-CVS] com php-src: Faster sorting algo: UPGRADING Zend/Makefile.am Zend/tests/methods-on-non-objects-usort.phpt Zend/zend_API.c Zend/zend_hash.c Zend/zend_hash.h Zend/zend_ini.c Zend

2015-01-18 Thread Rasmus Lerdorf
On 01/18/2015 11:45 AM, Stanislav Malyshev wrote: Hi! Yes, like I said, I am aware that the comparison function is flaky but it is still code that has worked for 15 years so we have to be clear about the BC break. The fact that it works up until the array Looking at that function, I'm not

Re: [PHP-DEV] [PHP-CVS] com php-src: Faster sorting algo: UPGRADING Zend/Makefile.am Zend/tests/methods-on-non-objects-usort.phpt Zend/zend_API.c Zend/zend_hash.c Zend/zend_hash.h Zend/zend_ini.c Zend

2015-01-16 Thread Simon J Welsh
That’s an invalid comparison function. It causes the current usort to reverse sort the array and I see no problem with that changing (you’re saying that a value for $a less than $b is in fact greater than it, and a value of $b less than or equal to $a is equal to it). On 17/01/2015, at 06:17,

Re: [PHP-DEV] [PHP-CVS] com php-src: Faster sorting algo: UPGRADING Zend/Makefile.am Zend/tests/methods-on-non-objects-usort.phpt Zend/zend_API.c Zend/zend_hash.c Zend/zend_hash.h Zend/zend_ini.c Zend

2015-01-16 Thread Rasmus Lerdorf
On 01/16/2015 03:54 PM, Simon J Welsh wrote: That’s an invalid comparison function. It causes the current usort to reverse sort the array and I see no problem with that changing (you’re saying that a value for $a less than $b is in fact greater than it, and a value of $b less than or equal

Re: [PHP-DEV] [PHP-CVS] com php-src: Faster sorting algo: UPGRADING Zend/Makefile.am Zend/tests/methods-on-non-objects-usort.phpt Zend/zend_API.c Zend/zend_hash.c Zend/zend_hash.h Zend/zend_ini.c Zend

2015-01-16 Thread Xinchen Hui
Hey: On Sat, Jan 17, 2015 at 8:20 AM, Rasmus Lerdorf ras...@lerdorf.com wrote: On 01/16/2015 03:54 PM, Simon J Welsh wrote: That’s an invalid comparison function. It causes the current usort to reverse sort the array and I see no problem with that changing (you’re saying that a value for

Re: [PHP-DEV] [PHP-CVS] com php-src: Faster sorting algo: UPGRADING Zend/Makefile.am Zend/tests/methods-on-non-objects-usort.phpt Zend/zend_API.c Zend/zend_hash.c Zend/zend_hash.h Zend/zend_ini.c Zend

2015-01-16 Thread Rasmus Lerdorf
On Jan 16, 2015, at 19:18, Xinchen Hui larue...@php.net wrote: Hey: On Sat, Jan 17, 2015 at 8:20 AM, Rasmus Lerdorf ras...@lerdorf.com wrote: On 01/16/2015 03:54 PM, Simon J Welsh wrote: That’s an invalid comparison function. It causes the current usort to reverse sort the array and I

Re: [PHP-DEV] [PHP-CVS] com php-src: Faster sorting algo: UPGRADING Zend/Makefile.am Zend/tests/methods-on-non-objects-usort.phpt Zend/zend_API.c Zend/zend_hash.c Zend/zend_hash.h Zend/zend_ini.c Zend

2015-01-16 Thread Xinchen Hui
Hey: On Sat, Jan 17, 2015 at 12:37 PM, Rasmus Lerdorf ras...@lerdorf.com wrote: On Jan 16, 2015, at 19:18, Xinchen Hui larue...@php.net wrote: Hey: On Sat, Jan 17, 2015 at 8:20 AM, Rasmus Lerdorf ras...@lerdorf.com wrote: On 01/16/2015 03:54 PM, Simon J Welsh wrote: That’s an invalid

Re: [PHP-DEV] [PHP-CVS] com php-src: Faster sorting algo: UPGRADING Zend/Makefile.am Zend/tests/methods-on-non-objects-usort.phpt Zend/zend_API.c Zend/zend_hash.c Zend/zend_hash.h Zend/zend_ini.c Zend

2015-01-16 Thread Xinchen Hui
Hey: On Sat, Jan 17, 2015 at 1:16 PM, Xinchen Hui larue...@php.net wrote: Hey: On Sat, Jan 17, 2015 at 12:37 PM, Rasmus Lerdorf ras...@lerdorf.com wrote: On Jan 16, 2015, at 19:18, Xinchen Hui larue...@php.net wrote: Hey: On Sat, Jan 17, 2015 at 8:20 AM, Rasmus Lerdorf ras...@lerdorf.com

Re: [PHP-DEV] [PHP-CVS] com php-src: Faster sorting algo: UPGRADING Zend/Makefile.am Zend/tests/methods-on-non-objects-usort.phpt Zend/zend_API.c Zend/zend_hash.c Zend/zend_hash.h Zend/zend_ini.c Zend

2015-01-16 Thread Pierre Joye
On Sat, Jan 17, 2015 at 6:24 AM, Xinchen Hui larue...@php.net wrote: Hey: On Sat, Jan 17, 2015 at 1:16 PM, Xinchen Hui larue...@php.net wrote: but okey, I agree we need write some note(actually I noted in UPGRADE of we are using hybrid sorting algo now).. but what kindof note I mean how