Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80215 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4821 invoked from network); 6 Jan 2015 02:39:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Jan 2015 02:39:07 -0000 Authentication-Results: pb1.pair.com smtp.mail=xinchen.h@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=laruence@php.net; sender-id=unknown Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.217.175 as permitted sender) X-PHP-List-Original-Sender: xinchen.h@zend.com X-Host-Fingerprint: 209.85.217.175 mail-lb0-f175.google.com Received: from [209.85.217.175] ([209.85.217.175:51208] helo=mail-lb0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D9/8F-21693-8CA4BA45 for ; Mon, 05 Jan 2015 21:39:05 -0500 Received: by mail-lb0-f175.google.com with SMTP id z11so11038585lbi.34 for ; Mon, 05 Jan 2015 18:39:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=qTe5BVlCAhr/xJUDuDMjoZGaTQT1OK3eVgM5KxqiQnA=; b=UG/tLap4GbJVjxzRks9mSJ6R6H5XacJKkWYGecbQGsRcB5/oIB5KSlYF/rwm/NRHud D2JDlTUGfnnNFYVsXJzNfBeExf1yvR07hWBKCgdMxhUsmjQTBc1o9cXv87Qf9kC9PbOd N8bmd0IMTPC46U8mIDyOnl8H8dqeKbv3oF34PsQegbULAYpjuQ28SBT6CqWSxZeuyOyj f0lCPrJm1zckpn6pDxmYwJ1hlKX8fYqncjqtbBfUjth8Dw8XCGQyAuBbU43Ozt1qYM8b XNpVZquxfO07QriXS/vBLXmnkAePyhmvLIJjs3G1vd7r+AEBM0FNUFk5r9kPu6zvW4++ Sv5g== X-Gm-Message-State: ALoCoQmqv1fZeP+r74QGZusWwCO8vsaozviGqKa3Ml8hlcOVC5Xjrgoq1XJGymGWmFs4VIx6xv7QNbPfiXBFfpDsmWfIixT70g6yynKbBnQHDQbSbEiheYx0v5fYEpqdg5B0JBNQDk7mJ9TxmA7mL1LOjHow40BDyw== X-Received: by 10.112.222.135 with SMTP id qm7mr95646578lbc.19.1420511941157; Mon, 05 Jan 2015 18:39:01 -0800 (PST) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPSA id ya4sm4932141lbb.32.2015.01.05.18.38.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 05 Jan 2015 18:38:59 -0800 (PST) Received: by mail-lb0-f180.google.com with SMTP id l4so18904948lbv.11 for ; Mon, 05 Jan 2015 18:38:59 -0800 (PST) X-Received: by 10.112.12.65 with SMTP id w1mr96372279lbb.68.1420511939005; Mon, 05 Jan 2015 18:38:59 -0800 (PST) MIME-Version: 1.0 Received: by 10.114.64.176 with HTTP; Mon, 5 Jan 2015 18:38:38 -0800 (PST) In-Reply-To: References: Date: Tue, 6 Jan 2015 10:38:38 +0800 Message-ID: To: David Zuelke Cc: PHP Internals , Dmitry Stogov , Nikita Popov Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Faster zend sorting implementation From: laruence@php.net (Xinchen Hui) On Tue, Jan 6, 2015 at 2:12 AM, David Zuelke 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 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/