Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80463 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93180 invoked from network); 14 Jan 2015 13:52:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jan 2015 13:52:52 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.171 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.171 mail-vc0-f171.google.com Received: from [209.85.220.171] ([209.85.220.171:40826] helo=mail-vc0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FA/71-19120-1B476B45 for ; Wed, 14 Jan 2015 08:52:50 -0500 Received: by mail-vc0-f171.google.com with SMTP id hy4so2866944vcb.2 for ; Wed, 14 Jan 2015 05:52:46 -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:date :message-id:subject:from:to:cc:content-type; bh=wbMUJ2tl2NH33RB7deHZ9zSDGJRodkRMpXSKhmMfttA=; b=S4PJf2a4IHZsWW7mSPtv4/CbX+EavVBmcJxwXfit4wHtpI1pJ987yBiUg4OmN49UhR 4PaAklCeEL92hkVotYJgnsuWbG3wc8eJo71+mixyIBsaWbAMv1Ftm7U72fWLiP/WX/Ra TAGfTyA+D747Heaje4IoBkSEXrjcH3ajDsqnCcBWnQmPwdg7zUFiZGU3uvbJ9A1HSDK7 NiXieygswgp+1QOQ6y9Cv0/6uBhs38OKXp7UPBbIugrn/JphzgEwOTzcoDwbhqUBZkcx 25sgeN/8fHLw5r4mY4czB8GVLwz3fi+BynDihHhkq8lYu5OswUiq+dd0IpJ7cykYqITU hGhA== X-Gm-Message-State: ALoCoQkyQfV4q7pXrFKwaevStZDSeT9+bf5obq56e/0+7pJDGs51nPMInQms7kaoBBwFCvwkazUnYy/Dw0AzFkAKAx7S0R3yiwaTAkkhXTLaUnU2cX6r26/O0xNmNUDtNByMM27Ac5GcOe9QhRO9TqVbcCeNEb3BPQ== MIME-Version: 1.0 X-Received: by 10.220.83.193 with SMTP id g1mr2903439vcl.46.1421243566247; Wed, 14 Jan 2015 05:52:46 -0800 (PST) Received: by 10.52.26.40 with HTTP; Wed, 14 Jan 2015 05:52:46 -0800 (PST) In-Reply-To: References: Date: Wed, 14 Jan 2015 17:52:46 +0400 Message-ID: To: Xinchen Hui Cc: PHP Internals , Nikita Popov Content-Type: multipart/alternative; boundary=001a11c2c67ae806fe050c9d0d39 Subject: Re: Faster zend sorting implementation From: dmitry@zend.com (Dmitry Stogov) --001a11c2c67ae806fe050c9d0d39 Content-Type: text/plain; charset=UTF-8 I don't see big problems committing this. In some cases new sort() functions may provide different results, but they are still valid, because the order of "equal" elements after sort is not defined. Thanks. Dmitry. On Wed, Jan 14, 2015 at 12:59 PM, Xinchen Hui wrote: > Hey: > > I made a PR here: https://github.com/php/php-src/pull/999 for > reviewing > > in benchmark this can brings more than 30% performance gain in > array_sort etc functions. > > tests fails are related to non-stable vs stable sorting difference. > > anyway, I feel it's better to ask you to do a final review, what > do you think? > > is there any objections to merge this? > > thanks > > On Tue, Jan 6, 2015 at 1:08 AM, 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/ > > > > -- > Xinchen Hui > @Laruence > http://www.laruence.com/ > --001a11c2c67ae806fe050c9d0d39--