Re: Faster zend sorting implementation

From: Date: Tue, 06 Jan 2015 02:38:38 +0000
Subject: Re: Faster zend sorting implementation
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-80215@lists.php.net to get a copy of this message
On Tue, Jan 6, 2015 at 2:12 AM, David Zuelke <dz@heroku.com> wrote: > This sounds reasonable, because given how the sort is *not* stable, there will be other cases > (totally made up, but let's say ["a", "o", "O"]) where the swap > does *not* happen. Consistency, and thus a stable sort, is better. yeah, I also think in the same way.. > > But you're saying your patch is "kind of a" stable sorting algo, so is it stable > only sometimes, or did you mean to say "a kind of"? > actually, I use insert sort if elements is less than 17(<=16). so... thanks > David > > >> On 05.01.2015, at 18:08, Xinchen Hui <laruence@php.net> wrote: >> >> Hey: >> >> I was working on zend_qsort improvement. but I got a problem need >> to be disscussed with you fist.. >> >> 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: >> >> array(2) { >> [0]=> >> string(1) "o" >> [1]=> >> string(1) "O" >> } >> >> do you think such BC break is acceptable? or I still need a RFC? :< >> >> thanks >> -- >> Xinchen Hui >> @Laruence >> http://www.laruence.com/ >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> > -- Xinchen Hui @Laruence http://www.laruence.com/

« previous php.internals (#80215) next »