Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126727 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id DB7921A00BC for ; Wed, 12 Mar 2025 14:19:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1741789023; bh=oUtvosMfcVBq2qfe2T+jbbYp8PLGNiWuIvONVfvHiDU=; h=Date:From:To:Subject:In-Reply-To:References:From; b=fPH/Pfab8WYCX9aWcEmcsNGdia35wlDK9xRYPhtv7gLjpfzX5rjbEfyMNiC7xWXOD HpmI48t3rhBcu7a6hsUzDmkpLf8ADvdlunotDpIPcv44UPLfgvn6xqxsthgZ0OLQDj r6bD3jm2PDei4F71xBwq6dJCCp25skWEpspvQ49u+7n0AVcniuI509HPgA5oo/uJcP Xb7jsoKlEv8MhGvwWUu1KjqY1ell4d0ATgrSq6mQAY9QRijk7Z5x4HqzvD2n5lCY9e BUaXvQ4yfR176uQYUop84p6XNq9+4vTMFqHCfsfhVl/Er1DmKE4rHoO9CiSypebUJG SCNzuZIlxf2+A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0F16F1801DC for ; Wed, 12 Mar 2025 14:17:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-a4-smtp.messagingengine.com (fhigh-a4-smtp.messagingengine.com [103.168.172.155]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 12 Mar 2025 14:17:01 +0000 (UTC) Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfhigh.phl.internal (Postfix) with ESMTP id B9CF81140255 for ; Wed, 12 Mar 2025 10:19:34 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Wed, 12 Mar 2025 10:19:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; h=cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1741789174; x=1741875574; bh=oUtvosMfcVBq2qfe2T+jbbYp8PLGNiWuIvONVfvHiDU=; b= Cs5Yt593kJP8Wb1ro4CjdxqnJRaNX2VpE8GxBevpN784OgmUlEfn5mlbF9uISZF3 hEPjIiAKRPSH1z5h5vF7RgpMSIx0RManvB1PfA18smdUT26/yw6hASAKJdSNqPq3 W7KVkAU64CXAS9iY7MiE+MQ28aKuHWFxCeSGcGMUrxKzhXU6UJGE9qqsKt7qqZAA ZutJelKS4HE+ukyRrV2+zVqkQjuJgimUVKpixno827zDPXBYthPPqaJUrJy0WCXW uzHyEviVf5mm0zPCexstuJ7qaPHLTDAGV5u13G3KZRzmOJ+10Nf3ABHgdRAKrDcR tplVwTnBIj+0jVJqE9Ui7g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1741789174; x=1741875574; bh=o UtvosMfcVBq2qfe2T+jbbYp8PLGNiWuIvONVfvHiDU=; b=eUe2TLKYyjDNKtrH/ Vt43Fq+glnyQcwec0Od0EqudI+utU3y0+tng0JKfG045F/SbDvooftrXCV87fIWn 3YJMIiWsD5yJBMgqJltyJeU+tYGFw2IhUpJg2wKseAgjiDEXPu6FfJU0+RKnvm46 TznPuPvW2EjyVx9Vh0ChIWHDw2W5voh0pGBJUZctl/EiBEkedbP3JCcXf9VqbSoe UGzQMs48EPZNCYf/7v5Cmgl8s1NXbIw8rSnPPEJMl0C/XGZM7a1hXndrwDk/YP1H 3zLma/27eLFXQa/9URrtTyNNT6sOKfQ3UjyUcWJio1oPYZ/vhf7P4h8KSYioH0vh lWBGA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduvdehvdelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpeffhf fvufgfjghfkfggtgfgsehtqhhmtddtreejnecuhfhrohhmpedftfhofigrnhcuvfhomhhm ihhnshculgfkoffuohfrngdfuceoihhmshhophdrphhhphesrhifvggtrdgtohdruhhkqe enucggtffrrghtthgvrhhnpeehleffteeigfevudetfedugedtudevledugeeugeelheei hfehgfdtkeevvefgleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehimhhsohhprdhphhhpsehrfigvtgdrtghordhukhdpnhgspghrtghpthht ohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepihhnthgvrhhnrghlsheslh hishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 12 Mar 2025 10:19:32 -0400 (EDT) Date: Wed, 12 Mar 2025 14:19:30 +0000 To: internals@lists.php.net Subject: Re: [PHP-DEV] [RFC] Pipe Operator (again) User-Agent: K-9 Mail for Android In-Reply-To: <5931820.DvuYhMxLoT@come-prox15amd> References: <38b57201-5091-4c68-988b-9ce3beac8fcb@cubiclesoft.com> <5931820.DvuYhMxLoT@come-prox15amd> Message-ID: Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 11 March 2025 09:00:52 GMT, "C=C3=B4me Chilliet" w= rote: >This would be way better on performances as a single foreach, no? >I feel like this pipe operator encourages coders to use array_* functions= with closures, which is often terrible performances compared to a loop=2E I think this highlights something that has been mentioned a few times over= the years: PHP badly needs more native functions for working with iterator= s=2E If each stage of the pipeline is lazily consuming an iterator and yiel= ding each value in turn, one major source of performance impact goes away, = because we don't have to repeatedly allocate intermediate arrays=2E It also= makes it much easier to work with infinite inputs, which obviously can't b= e flattened to an array=2E It also highlights why just letting all array functions accept iterable wo= uld *not* be the right approach: array_map(iterable):array would still have= to eagerly iterate its input, so we need a separate iter_map(iterable):Non= RewindableIterator (or whatever name)=2E Even iter_sum() might shortcut if = an invalid value was defined as an Error rather than Warning=2E This feels like one of those cases where different proposals complement ra= ther than blocking each other: iterator functions make pipes more efficient= to use, and pipes make iterator functions more pleasant to use=2E I'd like= both please=2E :) Rowan Tommins [IMSoP]