Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126860 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 2C6C11A00BC for ; Thu, 20 Mar 2025 14:15:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1742479968; bh=K7MKTVPsaZGCj3f1EkCBC9Sqpl3gmCJAwc67OGTq0mQ=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=Os5ovi8pTabi/jrXKxWL5aB/cymKYluS8AMLTk59QaI51NfkcS1nM5SHJcE/r4D6X /oEurxjUWaCHdIDCuwFrqok+jjVuXx52a7irz0dKH76skDox3bmrQmgVnL/ewgi0q5 5+EsMghnxiQIl8hD7fUo9rpPMLVwU4A75JZ2fHqTUIcUMKWtVwCPk7PEgueYMPmTmE qMnOFrz44WrB8JDgbeiA4MSTq7mgRAkP1kFdBf7TNUDJq4nn2MOwXPz/gPohJq86Gv DtjI0U1CJ8DhfGIIFsEqwCwAOStGCVAly0Tl6ilzhAnMAxbqEbZQhIv+RwwQ96wxod 0DCbfML0edvUw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 551F318005B for ; Thu, 20 Mar 2025 14:12:47 +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=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fout-b7-smtp.messagingengine.com (fout-b7-smtp.messagingengine.com [202.12.124.150]) (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 ; Thu, 20 Mar 2025 14:12:46 +0000 (UTC) Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfout.stl.internal (Postfix) with ESMTP id 2B9A31140144; Thu, 20 Mar 2025 10:15:17 -0400 (EDT) Received: from phl-imap-09 ([10.202.2.99]) by phl-compute-11.internal (MEProxy); Thu, 20 Mar 2025 10:15:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc:cc: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=fm2; t=1742480117; x= 1742566517; bh=K7MKTVPsaZGCj3f1EkCBC9Sqpl3gmCJAwc67OGTq0mQ=; b=Z 4IbToty4hox1r5uYWq1fxng9FU9LS0CIvYpq9mEL9THmWtjn7KYrTAcCyzPgQrii TuJHjUTMmGA+IqaF7Ct7pOkfmtqha4SSlgiq4qzoyMkoB05U4OJ/yyA46MA6H+s5 N5L+meE89nab3RfvEOIexvLA3PeCYjOCT9R6zeDKTUZp0mNaVQ0WPvr3JcyhXXYp mC3QmZ2XdoYUoDEsOXz75IxfDaoptI01HtmquZa2aJJ91rRjgj+g4OVfGUs2P/Ny 0z/2Zx+eHeg688iRsBfrmdxARJvo5iiNMO28nbsXYBQJPVVCgGN3sBhFL+YaHGXz nfu0EdxMVNJO+EqkP/IUQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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= 1742480117; x=1742566517; bh=K7MKTVPsaZGCj3f1EkCBC9Sqpl3gmCJAwc6 7OGTq0mQ=; b=Ahh41sXJ7DQyW6Mmp+o6h2cZZ0Jlzo7aC1Iih38i638mos+J2Ux NxGxrPD4ZjINCXkc/74jfrgTkXT2SXaelwxaVSZ25e7uT3+k+mYh/afXp6+AbvUr irFfHaxj0uVCmXAuoe5cnUrvSvpunKL6JbJ+lhLPOSg/xiK0UrfHnY11LAEadkBE dnRPC13uVUoqP6VGF2LNyfVEIj8eSIFMBIQjJL+o6gZ4xG4OJWQbJclzZCX4CX5n aoCWl/xpFm995SYasD8ArlScV2Ru1wy2sHxIZLTFgvZQqsTJV8J5wh8xIenW+X34 ilBgD8aTYOsvNG5A0ro3AJaZnSO0DOg76Eg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddugeekgedvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepofggfffhvfevkfgjfhfutgesrgdtreerredt jeenucfhrhhomhepfdftohgsucfnrghnuggvrhhsfdcuoehrohgssegsohhtthhlvggurd gtohguvghsqeenucggtffrrghtthgvrhhnpeeiueethedvvdefjefhgfeiheelheehtdfh feekjefflefgvedvkeduteejjedttdenucevlhhushhtvghrufhiiigvpedtnecurfgrrh grmhepmhgrihhlfhhrohhmpehrohgssegsohhtthhlvggurdgtohguvghspdhnsggprhgt phhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegvughmohhnugdrhh htsehgmhgrihhlrdgtohhmpdhrtghpthhtohepihhnthgvrhhnrghlsheslhhishhtshdr phhhphdrnhgvthdprhgtphhtthhopehimhhsohhprdhphhhpsehrfigvtgdrtghordhukh X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 8083B780068; Thu, 20 Mar 2025 10:15:16 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: Tddbc4133e529e9e0 Date: Thu, 20 Mar 2025 15:14:55 +0100 To: "Edmond Dantes" , "Rowan Tommins [IMSoP]" Cc: internals@lists.php.net Message-ID: <8d69c4d4-d393-4085-b60a-1063155ee8a3@app.fastmail.com> In-Reply-To: References: <72bd5401-53a9-409f-ad45-687333401961@rwec.co.uk> <6987D912-CE46-4145-A8CE-732CA590A522@rwec.co.uk> <2F013672-9937-4AB1-BC46-86F3D342BE6B@rwec.co.uk> <743c84d4-28db-4f68-80e5-3cad2dac6e68@rwec.co.uk> Subject: Re: [PHP-DEV] PHP True Async RFC - Stage 2 Content-Type: multipart/alternative; boundary=363e88bf54e446faa98e11cc43a8fefc From: rob@bottled.codes ("Rob Landers") --363e88bf54e446faa98e11cc43a8fefc Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Thu, Mar 20, 2025, at 12:01, Edmond Dantes wrote: > ```php > spawn fn() =3D> [file_get_content(), file_get_content(), file_get_cont= ent()] > ``` This example highlights one of the concerns I have with fibers and this = approach in general. That example will still execute synchronously, taki= ng file_get_contents() * 3, even though it is in a coroutine function. If you wanted to make it asynchronous, you'd have to do something like s= o: $x =3D [spawn fn() =3D> file_get_contents($a), spawn fn() =3D> file_get_= contents($b), spawn fn() =3D> file_get_contents($c)]; foreach($x as $i =3D> $spawn) $x[$i] =3D await $spawn; That is quite a bit more work than I'd like just to get async file readi= ng done. =E2=80=94 Rob --363e88bf54e446faa98e11cc43a8fefc Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

=
On Thu, Mar 20, 2025, at 12:01, Edmond Dantes wrote:
<= /div>
```php
spawn fn() =3D> [file_get_content(), file_get_content(), file_get_content()]
```

This example highlights one of the concerns I have= with fibers and this approach in general. That example will still execu= te synchronously, taking file_get_contents() * 3, even though it is in a= coroutine function.

If you wanted to make = it asynchronous, you'd have to do something like so:

<= /div>
$x =3D [spawn fn() =3D> file_get_contents($a), spawn fn() =3D= > file_get_contents($b), spawn fn() =3D> file_get_contents($c)];

foreach($x as $i =3D> $spawn) $x[$i] =3D = await $spawn;

That is quite a bit more work= than I'd like just to get async file reading done.

=
=E2=80=94 Rob
--363e88bf54e446faa98e11cc43a8fefc--