Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126711 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 054CF1A00BC for ; Tue, 11 Mar 2025 09:01:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1741683521; bh=+sRF3AF/S+ysEQZkEkY9TDWbcMaJesETjGTbaoI8M04=; h=From:To:Subject:Date:In-Reply-To:References:From; b=jHaYhVlOGoBcs8pv6BOPXzNnaslYH6Sryd+NVzNoaoe+ERfo1myx8qlXdtlkPls6F bPyU+mLyUZC5kwineAf/kGsDMTW46Wkx5vQ6pQpC2B0i6F4RX80OL5arTdX02UIWAo zaeHrilrB7wXWT2Rk4PQ/rtbZO7/g+LzP0yMaY8vWGCHbRa5+GgsGv48tnbRAGpil3 dRcGEG2EzLYKkW87sbLDxdQ4vcg5S+HqINiwGnKPl6EHTyxCghKkxjse7aomnT+CvZ Q4jC1ChdM2s79+gZgD0Qeak4/eO4u1y3LSFdpN3Ovov6oUaOxrNawLQZVf9izyPtct rduT1vHmDnT9A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B279A180032 for ; Tue, 11 Mar 2025 08:58:38 +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=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 ; Tue, 11 Mar 2025 08:58:35 +0000 (UTC) Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id A3E0B1A09AA for ; Tue, 11 Mar 2025 09:01:07 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 72A80605B2 for ; Tue, 11 Mar 2025 09:01:07 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id DCB381C22D7AC for ; Tue, 11 Mar 2025 10:01:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chilliet.eu; s=dkim; t=1741683667; h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to: references; bh=rxwylxgpeT0UzJp42kXNaonqyXCoUUWK3mb0zFYGqQo=; b=UGsDgTlTjRqrGIrbGIMCIUjV2JjenYVokqo5+6BnRdt9HM7N5pVkBmwAKh4t9gYgryna+g RpsjuF9xVk6frI41I/ihUnYKq03s1Tar9qLgiD3UjLGeeEs50rq4EW7K/tx9Y2POq98u6p uL5EUqZx8vZAUQOjdb+FfCx6XluyzPwGfAojVDxRY7KaDhAnXVOHE51sQxWUiPfHnZ60uy LlCs40WcmRZ39eGpgzrgbOsJWPXysMPWRRgxT55g7pwhkdEXjKV+W+edmvm3krQCXE5G2u vOFG6UcD5t1rHtyMP9xdPsw4n5M80FwJlUVTHLqPJgetrZS/sjuEQmn+OnpTCg== To: internals@lists.php.net Subject: Re: [PHP-DEV] [RFC] Pipe Operator (again) Date: Tue, 11 Mar 2025 10:00:52 +0100 Message-ID: <5931820.DvuYhMxLoT@come-prox15amd> In-Reply-To: <38b57201-5091-4c68-988b-9ce3beac8fcb@cubiclesoft.com> References: <38b57201-5091-4c68-988b-9ce3beac8fcb@cubiclesoft.com> Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart6200254.lOV4Wx5bFT"; micalg="pgp-sha512"; protocol="application/pgp-signature" X-Last-TLS-Session-Version: TLSv1.3 From: come@chilliet.eu (=?UTF-8?B?Q8O0bWU=?= Chilliet) --nextPart6200254.lOV4Wx5bFT Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8"; protected-headers="v1" From: =?UTF-8?B?Q8O0bWU=?= Chilliet To: internals@lists.php.net Subject: Re: [PHP-DEV] [RFC] Pipe Operator (again) Date: Tue, 11 Mar 2025 10:00:52 +0100 Message-ID: <5931820.DvuYhMxLoT@come-prox15amd> In-Reply-To: <38b57201-5091-4c68-988b-9ce3beac8fcb@cubiclesoft.com> MIME-Version: 1.0 Hello, I=E2=80=99m also wondering when I see code examples in the RFC like: $profit =3D [1, 4, 5]=20 |> loadMany(...) |> fn(array $records) =3D> array_map(makeWidget(...), $records) |> fn(array $ws) =3D> array_filter(isOnSale(...), $ws) |> fn(array $ws) =3D> array_map(sellWidget(...), $ws) |> array_sum(...); This would be way better on performances as a single foreach, no? I feel like this pipe operator encourages coders to use array_* functions w= ith closures, which is often terrible performances compared to a loop. How would the performance of the above compare with: $profit =3D 0; foreach (loadMany($input) as $item) { $widget =3D makeWidget($item); if (!isOnSale($widget)) { continue; } $profit +=3D sellWidget($widget); } C=C3=B4me --nextPart6200254.lOV4Wx5bFT Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEE8x20ac73tsA2u7cuwRZWc8b9+7kFAmfP+8QACgkQwRZWc8b9 +7lZwAf9G6qz5LnIxw9UyDoZev1NC0DDPwWsNVY3tyDVpVGFau/kTD/eTHbisF16 kUzqpdgCNBqRbueziTlniWV7Zz/vXN62cbtyTBcU5WSd01paqXEupOzCFpzQLHrP KynIm/MUrf6D0Z6fhZwbYsoinfKAYxCn7Mt7ul01JIpEBqGc7AFD9THCHBASDrvP UOPIXg3lfVZWyBFIaWaJ07l7eaHfLZDhXx6xudVh9gBxX9Pn8Xu1A8Iv+n5gcusk VgXGEUDqzDXpiE1kexzcX/oBUdvb7VHaDXVeKM6c+dDesQvt4VrCXqwleBOzCffB mWDPMC2wT+NX8F+dKuGKSAhbd6iHFg== =aSvM -----END PGP SIGNATURE----- --nextPart6200254.lOV4Wx5bFT--