Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80189 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46751 invoked from network); 5 Jan 2015 17:36:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jan 2015 17:36:19 -0000 Authentication-Results: pb1.pair.com header.from=laruence@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=laruence@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.45 as permitted sender) X-PHP-List-Original-Sender: laruence@gmail.com X-Host-Fingerprint: 209.85.220.45 mail-pa0-f45.google.com Received: from [209.85.220.45] ([209.85.220.45:58319] helo=mail-pa0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EE/25-21693-29BCAA45 for ; Mon, 05 Jan 2015 12:36:18 -0500 Received: by mail-pa0-f45.google.com with SMTP id lf10so29151276pab.32 for ; Mon, 05 Jan 2015 09:36:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=EAGcNFAhc42z3lTcXWtzP9JzuOwhVdwTR1XFzZizxXI=; b=bnYW98MYkM+IG6eilvaCqL77chKpYvSyoQ8aRzeaJXHERHIhyAyGPatprFNiRx+g/l 227Jth/7BRUqE/C3l2wY036oXZPU6nyDJeeDN39qbv/a83imrirPGw4r+wvnSF0kp9P6 kOznk+3EaD4RaygN4xFa2y/22S076fM1XuPNRSZgH0J24XqslcTnKM5An3kRNcSZFKgt ECy6+eN8CKP9EjtkXQlc17YZPkBmKTQbDeIM7AS8H6syUDOTQGyoogGVtMQ93VcCoj0C FNDOE0a5mcg7sppQE/nwDRl/VxZ59diXIC3uqL9LG027LOdQwqGcZ60Q3Pfg/wcXxzpY SM9g== X-Received: by 10.68.200.36 with SMTP id jp4mr135315368pbc.153.1420479375373; Mon, 05 Jan 2015 09:36:15 -0800 (PST) Received: from [10.20.0.5] (li753-58.members.linode.com. [106.185.42.58]) by mx.google.com with ESMTPSA id gw8sm25369842pbc.48.2015.01.05.09.36.10 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 05 Jan 2015 09:36:13 -0800 (PST) Content-Type: multipart/alternative; boundary=Apple-Mail-6B484B0D-F26C-4540-870F-E779F5835317 Mime-Version: 1.0 (1.0) X-Mailer: iPhone Mail (12B440) In-Reply-To: Date: Tue, 6 Jan 2015 01:36:03 +0800 Cc: Xinchen Hui , PHP Internals , Dmitry Stogov , Nikita Popov Content-Transfer-Encoding: 7bit Message-ID: <2F0DAC60-C06B-4C53-BE70-41B260C8093C@gmail.com> References: To: Julien Pauli Subject: Re: [PHP-DEV] Re: Faster zend sorting implementation From: laruence@gmail.com (Xinchen Hui) --Apple-Mail-6B484B0D-F26C-4540-870F-E779F5835317 Content-Type: text/plain; charset=gb2312 Content-Transfer-Encoding: quoted-printable Hey=A3=BA > On Jan 6, 2015, at 1:27 AM, Julien Pauli wrote: >=20 >> 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 =3D array("o", "O"); >> > sort($array, SORT_STRING|SORT_FLAG_CASE); >> > >> > var_dump($array); >> > >> > previously implementation does the swap: >> > >> > array(2) { >> > [0]=3D> >> > string(1) "O" >> > [1]=3D> >> > string(1) "o" >> > } >> > >> > but new implementation doesn't not: >> does not >> > >> > array(2) { >> > [0]=3D> >> > string(1) "o" >> > [1]=3D> >> > string(1) "O" >> > } >=20 > Hum, I dont think such a BC is acceptable. >=20 I am not sure if you get the problem? "O" and "o" are equal is that script The flags means using case-insensitive string sorting mean Thanks > There are tons of userland code out there relying on alpha case sorting th= at could get impacted.... > IMO :-) >=20 > Q: why extract the swap function from the qsort algo ? Is there an interes= t of replacing it at runtime ? >=20 >=20 > Julien.P --Apple-Mail-6B484B0D-F26C-4540-870F-E779F5835317--