Hey:

> On Jan 6, 2015, at 1:27 AM, Julien Pauli <jpa...@php.net> wrote:
> 
>> On Mon, Jan 5, 2015 at 6:09 PM, Xinchen Hui <larue...@php.net> wrote:
>> On Tue, Jan 6, 2015 at 1:08 AM, Xinchen Hui <larue...@php.net> wrote:
>> > Hey:
>> >
>> >      I was working on zend_qsort improvement. but I got a problem need
>> > to be disscussed with you fist..
>> first
>> >
>> >      as we know,  previously zend_qsort is not a stable sorting algo.
>> >
>> >      my draft patch (which already get 0.1% IRs reduce in wordpress)
>> > is kindof a stable sorting algo, you can find it here
>> > (https://github.com/laruence/php-src/compare/zend_sort)
>> >
>> >      so, there is a bc break, like for :
>> >
>> >      $array = array("o",  "O");
>> >      sort($array, SORT_STRING|SORT_FLAG_CASE);
>> >
>> >      var_dump($array);
>> >
>> >      previously implementation does the swap:
>> >
>> > array(2) {
>> >   [0]=>
>> >   string(1) "O"
>> >   [1]=>
>> >   string(1) "o"
>> > }
>> >
>> >      but new implementation doesn't not:
>> does not
>> >
>> > array(2) {
>> >   [0]=>
>> >   string(1) "o"
>> >   [1]=>
>> >   string(1) "O"
>> > }
> 
> Hum, I dont think such a BC is acceptable.
> 
I am not sure if you get the problem?

"O" and "o" are equal is that script

The flags means using case-insensitive string sorting mean

Thanks
> There are tons of userland code out there relying on alpha case sorting that 
> could get impacted....
> IMO :-)
> 
> Q: why extract the swap function from the qsort algo ? Is there an interest 
> of replacing it at runtime ?
> 
> 
> Julien.P

Reply via email to