Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80188 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44868 invoked from network); 5 Jan 2015 17:28:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jan 2015 17:28:28 -0000 Authentication-Results: pb1.pair.com smtp.mail=julienpauli@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=julienpauli@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.179 as permitted sender) X-PHP-List-Original-Sender: julienpauli@gmail.com X-Host-Fingerprint: 209.85.212.179 mail-wi0-f179.google.com Received: from [209.85.212.179] ([209.85.212.179:33993] helo=mail-wi0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D9/C4-21693-AB9CAA45 for ; Mon, 05 Jan 2015 12:28:27 -0500 Received: by mail-wi0-f179.google.com with SMTP id ex7so3786375wid.0 for ; Mon, 05 Jan 2015 09:28:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=vvAvAmheFr2nT0jGU/Mqq4VIDeXM7Cg7d8bYotvXniU=; b=SV3v8B6WqlKKmtxvjhiQIX8mmqW1GsusugsrJD+GVdfzsoqC+bycK0szJXqOofjLrt djFvgZfSZGUMv2ibhTr9kfXB/ZhGMUjLv01YVldk1Kkehl0vbNMdXSlN/DSITumcQ0WR SoAQJs5kVlKBqzIwGgAVIrApXduaLMcBErpQmWo86+GJJnd1gaR4Q8X+wZS/hZNGO6Yq 2voX4QOI03GrVgByejLKgpU7MZrkBjGzhlX8agyV1QUf4eIKZer5XP7Ip+RCeRAqiUyt SlmR5YvvyKzjpnwVtArttz1HRnXBlDywZgwmVg9aE8HG2s+pQVitH+kBS7zvZ6GTx02/ vsUA== X-Received: by 10.180.73.108 with SMTP id k12mr27684345wiv.24.1420478902586; Mon, 05 Jan 2015 09:28:22 -0800 (PST) MIME-Version: 1.0 Sender: julienpauli@gmail.com Received: by 10.195.4.41 with HTTP; Mon, 5 Jan 2015 09:27:42 -0800 (PST) In-Reply-To: References: Date: Mon, 5 Jan 2015 18:27:42 +0100 X-Google-Sender-Auth: 0DfRSawtmxsC7jFPtdzy-xBU8vU Message-ID: To: Xinchen Hui Cc: PHP Internals , Dmitry Stogov , Nikita Popov Content-Type: multipart/alternative; boundary=f46d043891d16651e8050beb0423 Subject: Re: [PHP-DEV] Re: Faster zend sorting implementation From: jpauli@php.net (Julien Pauli) --f46d043891d16651e8050beb0423 Content-Type: text/plain; charset=UTF-8 On Mon, Jan 5, 2015 at 6:09 PM, Xinchen Hui wrote: > 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.. > 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. 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 --f46d043891d16651e8050beb0423--