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 <he...@judahwright.me> 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 <cdtre...@gmail.com> 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
>
>

Reply via email to