Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94818 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51545 invoked from network); 3 Aug 2016 22:00:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Aug 2016 22:00:15 -0000 Authentication-Results: pb1.pair.com smtp.mail=ben.coutu@zeyos.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ben.coutu@zeyos.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zeyos.com designates 159.122.110.40 as permitted sender) X-PHP-List-Original-Sender: ben.coutu@zeyos.com X-Host-Fingerprint: 159.122.110.40 mx.zeyos.com Received: from [159.122.110.40] ([159.122.110.40:55272] helo=mx.zeyos.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 02/11-42458-D6962A75 for ; Wed, 03 Aug 2016 18:00:14 -0400 Received: from mx.zeyos.com (mx.zeyos.com [127.0.0.1]) by mx.zeyos.com (Postfix) with ESMTP id 84DCF86 for ; Thu, 4 Aug 2016 00:01:38 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mx.zeyos.com Received: from mx.zeyos.com ([127.0.0.1]) by mx.zeyos.com (mx.zeyos.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Q3CMWaMp9Sqr for ; Thu, 4 Aug 2016 00:01:38 +0200 (CEST) Received: from 127.0.0.1 (unknown [89.163.135.32]) by mx.zeyos.com (Postfix) with ESMTPSA id 3BAFA82; Thu, 4 Aug 2016 00:01:36 +0200 (CEST) Date: Thu, 04 Aug 2016 00:00:00 +0200 To: PHP Internals Cc: Xinchen Hui MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20160803220138.84DCF86@mx.zeyos.com> Subject: Re: [PHP-DEV] More packed hash optimizations in array.c From: ben.coutu@zeyos.com (Benjamin Coutu) Hello Xinchen,=0A=0AThanks for changing array_pad and array_rand accordingl= y, that's very good.=0A=0AI noticed a small improvement we could make to ar= ray_slice for the packed case:=0A=0AWe can change line 3003:=0Aif ((Z_ARRVA= L_P(input)->u.flags & HASH_FLAG_PACKED) && !preserve_keys)=0A=3D>=0Aif ((Z_= ARRVAL_P(input)->u.flags & HASH_FLAG_PACKED) && (!preserve_keys || offset = =3D=3D 0))=0A=0ASo whenever the input array is packed, we can of course saf= ely use a packed array for the output array when preserve_keys is false, bu= t also when preserve_keys is true and if (only if) the offset is zero, beca= use offset=3D0 on a packed array will yield the same result no matter wheth= er preserved_keys is true or false.=0A=0ABen