Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93347 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72850 invoked from network); 16 May 2016 01:46:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 May 2016 01:46:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 66.111.4.29 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 66.111.4.29 out5-smtp.messagingengine.com Received: from [66.111.4.29] ([66.111.4.29:43267] helo=out5-smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D6/D0-65275-16629375 for ; Sun, 15 May 2016 21:46:10 -0400 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 2771020638 for ; Sun, 15 May 2016 21:46:07 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute7.internal (MEProxy); Sun, 15 May 2016 21:46:07 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=OFO7UJZ1uRnamoZ f9pfWXJ4mBcc=; b=qcNqAYcbRnKqddK4OlSM9GhRtZYubwOCIzqh7cSALvW55Rp gas2Jr8R+JEOMLrBUu2BniF6fRyXH3XSK3SPU8UqmcSVmH4Xnyj9kNH42PUHLJw1 Q0NSXBHH2Dqo1g/8hIMErJ+0l4fzk5kg0E8YtChgyC+ZIoe6W8gAzL6h6l0o= X-Sasl-enc: r2F3jsycYeNpqV4e+jUSvzTO5SUybrKVy9knpYblL70L 1463363166 Received: from [192.168.42.5] (c-50-178-40-84.hsd1.il.comcast.net [50.178.40.84]) by mail.messagingengine.com (Postfix) with ESMTPA id DD421C00017 for ; Sun, 15 May 2016 21:46:06 -0400 (EDT) To: internals@lists.php.net References: Message-ID: <5739265E.2060602@garfieldtech.com> Date: Sun, 15 May 2016 20:46:06 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Assess acceptability of having php-ds into core From: larry@garfieldtech.com (Larry Garfield) On 05/12/2016 08:27 PM, guilhermeblanco@gmail.com wrote: > Hi internals, > > PHP 7 leverages a lot the performance internally and many PHP applications > in the wild. Much of these improvement came by experimentation through > PHPNG and the usage of efficient data structures internally. This idea of > performance improvements are crucial to handle more requests, reduce server > overload, etc. > > However, what lacks in PHP is the exposure of more efficient, use case > specific data structures, that could allow end users to easily improve > performance of their applications, instead of using a general, > multi-purpose data structure that we have as "array". > > Based on that (please keep in mind I haven't spoken with library author), > I'd like assess the receptability of incorporating php-ds library into core. > > Library author wrote a good (and lengthy) article explaining his motivation > and performance benchmarks around it. Here are the related links: > > Article: > https://medium.com/@rtheunissen/efficient-data-structures-for-php-7-9dda7af674cd > Extension: https://github.com/php-ds/extension > Polyfill: https://github.com/php-ds/polyfill > Tests: https://github.com/php-ds/tests > Benchmark: https://github.com/php-ds/benchmarks > > > Best regards, I am all for more efficient and performant tools being available natively. However, the php-ds extension in particular, while it sounds very nice, is still missing what I believe are key collection-related operations, that is, set-level operations. The equivalents of array_map, array_filter, first(callable) (ie, the first item that passes a given callable condition), etc. are all extremely powerful collection-level, functional operations. We have array-based versions and have for many years, but having them on formal collections or objects has always been a sore point, and run into various road blocks of "arrays aren't objects", "but then we can't extend the set of operations", etc. The pipe syntax currently being discussed helps some, but it's not as clean as doing it natively. If we're going to improve the quality of our native collection tools, then a richer set of operations (for which there is a known list of common operations from most functional languages) needs to be part of that discussion. --Larry Garfield