Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80219 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13864 invoked from network); 6 Jan 2015 04:42:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Jan 2015 04:42:29 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.50 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.192.50 mail-qg0-f50.google.com Received: from [209.85.192.50] ([209.85.192.50:50264] helo=mail-qg0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A2/11-21693-3B76BA45 for ; Mon, 05 Jan 2015 23:42:27 -0500 Received: by mail-qg0-f50.google.com with SMTP id z60so16132448qgd.37 for ; Mon, 05 Jan 2015 20:42:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=KI3kka6L6jgtytsKrzMzv1igXImVf9FFMY4O7yBz0/I=; b=QXGkDAH/X2PnSFmJhqGVQ0FGVt+re3ajujWuMWGDacFNyDNozYbdckgoTsZSRVV13a 4Uj/IcpgK4DuI0bokvQ/QuH+0s+JYlKKBDr+SRn7xyGnrYj3RAUv37o7gFszLtlaY5Mv H4iOCX8tWkdtH1Eb9VNtitmSpl4RW9HpuMR0TUj2EfYc7StbqT10DNOxDjNH3eeFDvau Mt/z6pbR1z+S5js2aTAdDIsAfQK0L0UVVucmIlOqj669WWageLKQG+sLlpdUSfLILzUG a8/JBDGjQFVvfyvZ+VmIeOEr9kGPe06ZGVZSiSHKnDDfuCFbV+pxGU7sSt7PJvJu1ZK9 GvLg== MIME-Version: 1.0 X-Received: by 10.140.32.166 with SMTP id h35mr139640317qgh.22.1420519343862; Mon, 05 Jan 2015 20:42:23 -0800 (PST) Received: by 10.140.22.106 with HTTP; Mon, 5 Jan 2015 20:42:23 -0800 (PST) In-Reply-To: References: Date: Mon, 5 Jan 2015 20:42:23 -0800 Message-ID: To: Xinchen Hui Cc: PHP Internals , Dmitry Stogov , Nikita Popov Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Faster zend sorting implementation From: pierre.php@gmail.com (Pierre Joye) hi :) On Mon, Jan 5, 2015 at 9: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? :< I am not sure about that. Introducing a not easy to catch BC break for 0.1% gain on function (or even for the whole app) is not very appealing. However, there is nothing in the documentation actually describing how it works and there are clear warnings about the unpredictable results. That means we won't actually break it,per definition. I only wonder if it is worth the effort for such little gain (yes, the ocean is made of drops ;). Cheers, -- Pierre @pierrejoye | http://www.libgd.org