Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107945 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 66377 invoked from network); 23 Dec 2019 18:54:10 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 23 Dec 2019 18:54:10 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id ED9342C0583 for ; Mon, 23 Dec 2019 08:55:37 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp3.php.net X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: X-Spam-Virus: No Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp3.php.net (Postfix) with ESMTPS for ; Mon, 23 Dec 2019 08:55:37 -0800 (PST) Received: by mail-lj1-x236.google.com with SMTP id m26so15916829ljc.13 for ; Mon, 23 Dec 2019 08:55:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WIS1Tf+LozrOqz1HFWiYIO51mJzCc0E/zVCq4OHTEIY=; b=sTd5anwZ1YHgm8TnQL8Y8dNWilhiCU3CM3S3ragFAUEtP0TWdmMTXWNu6qi3hoRveh dRYR3HoDQzEDl1HTEPI2fxOnaTMP0uCqbSXRZ3NUGYwoKehuY38Q+hGhoWWnFPofNN32 1C5eGFsaeEuQhzNA8saRJGcmolIiXamwUf43nJjn6X4V+td1KJsYbV9ol/MWkIxV6L/j aAsyazDKeoYDdw39AwiUIYfYqVyuajOxon1RNZvja9jydw0FSn0ylSBecpQ2OqVNSool cTfvwT0Vpj+iY6Ri1CBbuaQDt53Qf0NbxApVtu1vZvHvOnx7dX+Mdx6SyuVGA5ZoAB6Q xT3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WIS1Tf+LozrOqz1HFWiYIO51mJzCc0E/zVCq4OHTEIY=; b=q8OT0lT25fJgtu1KGXeRrvxyzb61T5qm+AzjvhL8fPaIEKXWfBG2Spp6ty9fSOPKjw npTjwJVSofn5pTh5sSiNnOerJweXZOyYkx/KIDG9jlN9J00IS1C/DN7Gz+8WLq+tw6dg 3WGEmOVjoNMH/6BL3j8u7LToS0+E55V8sxA5TfcSTJzKt9deFmFQLfmoopfTIlyeSJgs TwAJ2lodnCLpOTdtHlg2Iywsssi4/fcvzlZirT1dAzJkfdCHvsqVr7mnX+HW3vEbS4ix QgoU1NoDqrjI+51pAKe3/ZAKhXahvwjDn/K3NOeLYG4TkBH1mV9glVfuJtcaTaA6TIBC 9LDg== X-Gm-Message-State: APjAAAXZ4ZB3jwCYMeRd/dvXyKaJDSg0KpspihS5aVTCipPGZb2Pvq5m 2QHQj9HYn0/ZqVUSeljwwONNhgd521G4YTNbFTcOMuST X-Google-Smtp-Source: APXvYqxurLr8gN0K1Gbx/l+L2EvrCvT1RxE7F1NIAJjuDJvqeRuN3x1OO1/235345VkWcPNXoU0yWA+slLoZ5m7ElN4= X-Received: by 2002:a2e:93c9:: with SMTP id p9mr18561083ljh.136.1577120135990; Mon, 23 Dec 2019 08:55:35 -0800 (PST) MIME-Version: 1.0 References: <1577115369.5410.0@judahwright.me> In-Reply-To: <1577115369.5410.0@judahwright.me> Date: Mon, 23 Dec 2019 16:55:06 +0000 Message-ID: To: Judah Wright Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000795444059a61e5ae" X-Envelope-From: Subject: Re: [PHP-DEV] Support for Async / Await From: cdtreeks@gmail.com (Aran Reeks) --000000000000795444059a61e5ae Content-Type: text/plain; charset="UTF-8" Whilst it'd take work on both the internals and userland sides to implement, with so much of the web being powered by PHP, having the ability to even construct pages in parallel could really speed things up. In the most simplistic way, imagine rendering multiple view components on a site in parallel (main body content, header, footer). Being able to fetch each component's data from the DB separately and then write out the resultant output to a cache mechanism. Run imports, or perform API tasks asynchronously... These are the sort of workloads we face regularly. I for one can certainly see why it was one of the first things Hack added support for when Facebook released it, and hopefully, we can find a way to do the same for PHP in the future too. On Mon, 23 Dec 2019 at 15:36, Judah Wright wrote: > I really like this idea, non-blocking IO via asynchronous operations in > PHP would be amazing. > > I am running into an issue right now where I want to listen to several > different socket streams for data. One example of this would be: > > 1. Open socket A > 2. Wait for data > 3. Close socket A > 4. Open socket B > 5. Wait for data > 6. Close socket B > > This would be so much easier if I could just listen on both in a non-IO > blocking fashion. I would find this immensely useful. > > ~Judah > > On Sun, Dec 22, 2019 at 8:59 pm, Aran Reeks wrote: > > Hi Internals, Since the start of PHP 7, we've seen some amazing > performance improvement version by version as a result of core updates. Now > some of the biggest wins have been implemented (with JIT due for PHP 8), > I'd personally love to see support for Async / Await introduced in PHP's as > a core language feature too. Being able to perform tasks in parallel such > as reading or writing to DB, cache, queues... Would be a massive advantage > and the performance gains from it could be really exciting! Looking at how > Hack has implemented support, this seems like it could be a great start for > a RFC, what does everyone else think? Here's a link to Hack's > implementation for reference: > https://docs.hhvm.com/hack/asynchronous-operations/some-basics Thoughts > welcome from everyone. Cheers, Aran > > --000000000000795444059a61e5ae--